GetChildren (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy
Fixed another spacing issue
>Mr Doom Bringer
No edit summary
Line 1: Line 1:
{|
{|
|<onlyinclude>
|<onlyinclude>{{Function|
{{Function|
name                  = GetChildren
name                  = GetChildren
|arguments            =  
|arguments            =  
Line 7: Line 6:
|description          = Returns a read-only table of this Object's children
|description          = Returns a read-only table of this Object's children
|object              = Global
|object              = Global
|}}
|}}</onlyinclude>
</onlyinclude>
|}
|}



Revision as of 00:14, 14 July 2010

GetChildren( )
Returns Table children
Description: Returns a read-only table of this Object's children

Example

(Simple example)


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

(More efficient 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