print(game.Workspace:GetChildren(3).Name) the output i get from this is a table but i want the name, how can i make that happen?
COMMUNITY QUESTION
How can i make it print child number 3's name?
3 answers
Since GetChildren returns an array/table you can just do this.
print(game.Workspace:GetChildren()[3].Name)
You could do: (I don't know why you would do this but ok)
local t = workspace:GetChildren()
local c = 0
for i,v in pairs(t) do
if c == 3 then
print(v.Name)
c = c + 1
else
if c < 3 then
c = c + 1
end
end
end
If you want to find the child with name number 3 do:
if workspace:FindFirstChild("3") then
print(workspace:FindFirstChild("3").Name)
end
If I didn't understand what you meant please leave a comment.
Just a simple way to do it
local ThirdChild = game.Workspace:GetChildren()[3] --Gets the third value from the Array
1 comment
0
I didnt see Vinceberget Answer ;) and i forgot .Name
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
what im trying to do is to print the 3rd child's name and this sadly does not do that, it prints the first 3 children instead
I edited, try now