GetChildren (Method)

From Legacy Roblox Wiki
Revision as of 18:41, 26 October 2010 by >Oysi93 (We don't want people iterating with numeric for, do we now...)
Jump to navigationJump to search
GetChildren( )
Returns Table children
Description: Returns a read-only table of this Object's children.
Member of: Instance
Example

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

  • Generic for (More efficient example)
  • Highly recommended you use this one below.
Example
local children = game.Workspace:GetChildren()
for index, object in ipairs(children) do
    print("index: ",index)
    print("Object:",object)
end