OnDestroy||doc136702

September 20, 2022

Format

local event = Window:GetEvent("OnDestroy")

Describe

The event is triggered before the target control is destroyed.

Callback function parameters

Type name introduce
Window window current window

Code example

-- Create a Image widget
local window = UI:CreateGUIWidget(Enum.WidgetType.Image)
window.Parent = UI.Root

local event = window:GetEvent("OnDestroy")
event:Bind(function(window)
    print("window destroy!", window.name)
end)

window:Destroy()