I'm making a GUI that is a list of all players on the server. I proceeded to test it, and it didn't do anything. There was nothing in the output. I figured out that it was the PlayerAdded event, and the actual function worked.
Here is the code:
function MakeList()
print("Making list")
Players = game.Players:GetChildren()
for i = 1, #Players do
btn = script.Parent.Parent.TextButton:Clone()
print("Button cloned.")
btn.Parent = script.Parent
print("Button moved.")
btn.Text = Players[i].Name
btn.Visible = true
end
end
game.Players.PlayerAdded:connect(MakeList)
game.Players.PlayerRemoving:connect(MakeList)
I also tried:
function MakeList()
print("Making list")
Players = game.Players:GetChildren()
for i = 1, #Players do
btn = script.Parent.Parent.TextButton:Clone()
print("Button cloned.")
btn.Parent = script.Parent
print("Button moved.")
btn.Text = Players[i].Name
btn.Visible = true
end
end
game.Players.PlayerAdded:connect(function()
MakeList()
end)
Why are neither of these doing anything when a player enters the game?

2 comments
I did realize that, but I decided to take it one step at a time. There are no text buttons inside the directory it clones to. When a player joins the game, the function, for some reason, doesn't fire, and therefore no textboxes even are put into that directory.
If this is in a LocalScript, just remember that game.Players.PlayerAdded and game.Players.PlayerRemoving arent very cooperative with LocalScripts