The title says it.
How to get child of Specified Index? Example:
parent:GetChild(2)
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]
.
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)
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.