Update class.lua

This commit is contained in:
세젤귀 고양이들 2021-12-21 00:58:31 +09:00 committed by GitHub
parent d0864754bc
commit 0467c0cad6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -181,6 +181,10 @@ function module.init(shared)
rawset(self,"__parent",parent); rawset(self,"__parent",parent);
mount(item,parent) mount(item,parent)
end end
-- prevent gc
((type(object) == "table" and object.__object) or object):GetPropertyChamgedSignal "ClassName":Connect(function()
return item;
end);
return self; return self;
end end
@ -208,6 +212,10 @@ function module.init(shared)
end end
end end
end end
-- prevnet gc
((type(object) == "table" and object.__object) or object):GetPropertyChamgedSignal "ClassName":Connect(function()
return item;
end);
if lastObject then -- remove old instance if lastObject then -- remove old instance
self:Destroy(lastObject); self:Destroy(lastObject);
end end
@ -227,6 +235,7 @@ function module.init(shared)
end end
end end
end end
self = nil;
end end
--- link to new --- link to new