OnChildRemoved||doc136713

September 20, 2022

Format

local event = Instance:GetEvent("OnChildRemoved")

Describe

Triggered after removing child nodes from an instance。 The removal event will also be triggered when the child node is destroyed.

Callback function parameters

Type name introduce
Instance instance Current instance
Instance child Removed child node instances

Code example

local map = World:GetStaticMap("map001")
local part = Instance.new("Part", map.Root)
local childPart = Instance.new("Part", part)

local event = part:GetEvent("OnChildRemoved")
event:Bind(function(instance, child)
    print("remove child!", instance, child)
end)

childPart:Destroy()