PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

ChildAdded

Fires after an object is parented to this Instance.

Note, when using this function on a client to detect objects created by the server it is necessary to use Instance/WaitForChild when indexing these object’s descendants. This is because the object and its descendants are not guaranteed to replicate from the server to the client simultaneously. For example:

workspace.ChildAdded:Connect(function(child)
	-- need to use WaitForChild as descendants may not have replicated yet
	local head = child:WaitForChild("Head")
end)

Note, this function only works for immediate children of the Instance. For a function that captures all descendants, use Instance/DescendantAdded.

See also, Instance/ChildRemoved.

Parameters

Name Type Default Description

The Instance that has been added.


Code Samples


Instance.ChildAdded

This snippet prints the names of objects as they are added to the Workspace: