Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

how do i get the amount of children?

Asked by 4 years ago

saw some guy sometime say that u could get the amount of children inside something using something like this code

for i,v in pairs(game.Players.LocalPlayer.PlayerGui:GetChildren()) do
        if v > 1 then
            print("more")
        end
    end

but all i get is an error, how would i make this work?

2
When you make a for-loop, the variables you make are assigned to what the iterator returns (first = index and second = value). If you want to check how many children there are, just use the length of the table. print( #PlayerGui:GetChildren() ). The # operator gets the length of the expression (in a table's case: the amount of fields) pidgey 548 — 4y
0
Table tutorial here: http://lua-users.org/wiki/TablesTutorial chess123mate 5873 — 4y
0
making it into a local variable got me there, thanks Gameplayer365247v2 1055 — 4y

1 answer

Log in to vote
-1
Answered by 4 years ago
#object:GetChildren()
Ad

Answer this question