GetChildren (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Oysi93
We don't want people iterating with numeric for, do we now...
>Oysi93
We don't want people iterating with numeric for, do we now...
(No difference)

Revision as of 18:41, 26 October 2010

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