Scripting / Method
GetChildren()
Returns the direct children of an Instance or Workspace.
Syntax
instance:GetChildren()Return value
| Name | Type | Description |
|---|---|---|
return | table | A 1-indexed table of direct child instances. |
Example: Rename Direct Children
Luau
local folder = workspace:FindFirstChild("Generated")
if folder then
for index, child in ipairs(folder:GetChildren()) do
child.Name = "Item" .. index
end
endChildren vs descendants
GetChildren() only returns one hierarchy level. Use GetDescendants() when you need everything nested below an object.