Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I get the names of all children?

So I'm making a gui that will display all of the pieces of a player on a surface gui. I also have it printing them. I got it to do it, but it does them individually. So the gui will display only one of them. How do I get it to either display all of them, or display each of them on different text labels? Here is my gui so far:

script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
	local children = hit.Parent:GetChildren()
	for index, children in pairs(children) do
		print(index, children.Name)
		game.Workspace.List.SurfaceGui.Frame.TextLabel.Text = children.Name
		game.Workspace.List.SurfaceGui.Frame.TextLabel.TextSize = 5
	end
end
end)

2 comments

0

children:GetChildren() line 4 or just use GetDescendants() -- gets all children

0

So it'll get them all at once instead of in a list?

1 answer

Lunes 3 and 4. You overrode the children variable on line 3 on line 4. Name the line 4 variable "child" and change the textlabel things from children.Name to child.Name

1 comment

0

That won't really help as he doesn't clone the textlabel

This discussion is preserved as it was. New answers, comments, and votes are closed.