GetChildren (Function): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Anaminus
No edit summary
>ArceusInator
better example
Line 13: Line 13:
<pre>
<pre>
local children = game.Workspace:GetChildren()
local children = game.Workspace:GetChildren()
for num, child in pairs(children) do    -- pairs iterates through a table
 
    print(num, child.Name)
for i = 1, #children do
   if children[i]:IsA( "BasePart" ) then
      children[i].Color = Color3.new( 1, 0, 0 )
  end
end
end
</pre>
</pre>

Revision as of 21:45, 27 December 2010

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

Description

Example
local children = game.Workspace:GetChildren()

for i = 1, #children do
   if children[i]:IsA( "BasePart" ) then
      children[i].Color = Color3.new( 1, 0, 0 )
   end
end


See Also