For example I create objects whenever a player gets a new tool
When the player dies it loses the weapon, how do I clean the unused object?
--Example
local Pillow = PillowClass.new(Type.Value, Child.Handle, Player)
Pillow:onTouched()
``
For example I create objects whenever a player gets a new tool
When the player dies it loses the weapon, how do I clean the unused object?
--Example
local Pillow = PillowClass.new(Type.Value, Child.Handle, Player)
Pillow:onTouched()
``
Custom classes don’t have the destroy methods.
@OP, to actually clear out the objects out of the memory, you can write a custom function that handles the equivalent function of :Destroy()
, which will:
Does Debris service is a solution for this?
Technically, it clears out all Instance
objects associated to the class, but not its remaining bits of connections or certain variables holding references, if those ever existed. However, that API is solely for purposes of a delayed removal of an object without it ever experiencing an error from the object being already destroyed.
How do I clear connections?
Pillow = nil?
If the reference is somewhere, then you can do exactly that.