How to get child of Specified Index?

The title says it.

How to get child of Specified Index? Example:

parent:GetChild(2)

To get an index from any table all you need to do is add the square brackets [].
Ex: table[1] or in your case parent:GetChildren()[2].

3 Likes

You could use in pairs loop to get second child.

for i,v in pairs(parent:GetChildren()) do

wait(0.1)

if i == 2 then

print(v.Name)

end


end)

This isn’t the most efficient way - you can just index it directly, as @MrMoled suggests.

Yes,indeed.
But that’s a table, @FlamingHawk7 was trying to get It without indexing a table.

What does this mean? Nowhere in the thread does it say that OP is trying to avoid tables and GetChildren returns a table anyway, which you need to actually get a child at a certain index. For loops require a table to iterate through.

The loop is unnecessary. Just use a numeric indice after getting the table.

Using GetChildren() Returns a table.