Destroyed
Fires a callback function when an instance hydrated or created with New gets destroyed.
| Type | Since | Scoped |
|---|---|---|
| Declaration | 0.3.3 | No |
Constructor
[Destroyed] = () -> nil
Usage
Destroyed allows you to attach a callback function to an instance when it destroyed.
It works like this:
local New = Seam.New
local Destroyed = Seam.Destroyed
local Object = New("ScreenGui", {
[Destroyed] = function()
print("I've been destroyed!")
end,
})
Object:Destroy() -- Prints "I've been destroyed!"