GetChildren (Function)

From Goodblox Wiki
Revision as of 11:36, 23 June 2020 by Pizzaboxer (talk | contribs) (Created page with "<onlyinclude>{{Function| name = GetChildren |arguments = |returns = Table ''children'' |description = Returns a read-onl...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
Function
Syntax GetChildren( )
Returns Table children
Description: Returns a read-only table of this Object's children
In Object: Global


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