PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

ChildRemoved

Fires when a child is removed from this Instance.

Removed refers to when an object’s parent is changed from this Instance to something other than this Instance. Note, this event will also fire when a child is destroyed (using Instance/Destroy) as the destroy function sets an object’s parent to nil.

This function only works for immediate children of the Instance. For a function that captures all descendants, use Instance/DescendantRemoved.

See also Instance/ChildAdded.

Parameters

Name Type Default Description

The Instance that has been removed.


Code Samples


Instance.ChildRemoved

This snippet prints the names of objects as they are removed from the Workspace:

Workspace.ChildRemoved:Connect(function(instance)
    print(instance.Name .. " removed from the Workspace")
end)
local part = Instance.new("Part", Workspace)
wait(2)
part:Destroy()