GetChildren (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Camoy more solid article |
>LocalChum grammar |
||
Line 15: | Line 15: | ||
</pre>}} | </pre>}} | ||
{{Example| | {{Example|It is highly recommended to use GetChildren with a [[Generic for]] loop.<pre> | ||
for index, object in ipairs(game.Workspace:GetChildren()) do | for index, object in ipairs(game.Workspace:GetChildren()) do | ||
print("Index: ", index) | print("Index: ", index) |
Revision as of 23:50, 8 January 2012
![]() | |
Returns | Table children |
Description: | Returns a read-only table of the object's children. |
Member of: | Instance |
Example
Using GetChildren with a for loop.local children = game.Workspace:GetChildren() for i = 1, #children do print(children[i].Name) end
Example
It is highly recommended to use GetChildren with a Generic for loop.for index, object in ipairs(game.Workspace:GetChildren()) do print("Index: ", index) print("Object:", object) end