GetChildren (Method)

From Legacy Roblox Wiki
Revision as of 15:51, 30 August 2010 by >Camoy (fixed)
Jump to navigationJump to search
GetChildren( )
Returns Table children
Description: Returns a read-only table of this Object's children.
Member of: [[RBX.lua.Instance (Object)|Instance]]
Example

local children = game.Workspace:GetChildren()
for c = 1, #children do
    print(children[c].Name)
end

Example
local children = game.Workspace:GetChildren()
for i, j in ipairs(children) do
    print("index: ")  --j is the object, i is the index of the table it is at
    print(i)
    print("Object: ")
    print(j)
end