Returns an array (a numerically indexed table) containing all of the
Instance's direct children, or every
Instance/Parent|Parent is equal to the object. The array can be iterated upon using either a numeric or generic for-loop:
-- Numeric for-loop example local children = workspace:GetChildren() for i = 1, #children do local child = children[i] print(child.Name .. " is child number " .. i) end
-- Generic for-loop example local children = workspace:GetChildren() for i, child in ipairs(children) do print(child.Name .. " is child number " .. i) end
The children are sorted by the order in which their
Instance/Parent|Parent property was set to the object.
See also the
An array containing the
The below would print the name of all objects currently in Workspace when ran.