Skip to main content

Destroyed

Runs a callback when an instance created or hydrated with New is destroyed.

TypeSinceScoped
Declaration0.3.3No

Constructor​

[Destroyed] = () -> ()

Usage​

local Object = New("ScreenGui", {
[Destroyed] = function()
print("I've been destroyed!")
end,
})

Object:Destroy() -- Prints once

Implemented with Instance.Destroying:Once, so the callback runs once when destruction begins.