OnChildRemoved||doc136704

September 20, 2022

Format

local event = Window:GetEvent("OnChildRemoved")

Describe

Event triggered when a child control is removed from the target control. When a child control is destroyed, it is also removed from the parent control.

Callback function parameters

Type name introduce
Window window current window
Window child Child controls added

Code example

local event = UI.Root:GetEvent("OnChildRemoved")
event:Bind(function(window, child)
    print("UI Root remove child!", child.name)
end)

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

window.Parent = nil