local frame = script.Parent
local labels = {}
for i = 1, game.Players.MaxPlayers do
labels[i] = frame:WaitForChild("Player"..i)
end
local players = game.Players:GetPlayers()
for number = 1, #labels do
labels[number].Text = tostring(players[number] or "")
end
08:39:02.906 - Infinite yield possible on 'Players.Player1.PlayerGui.PlayerListUI.PlayerListFrame:WaitForChild("Player11")' 08:39:02.908 - Script 'Players.Player1.PlayerGui.PlayerListUI.PlayerListFrame.LocalScript', Line 7 08:39:02.909 - Stack End
I have 10 TextLabels inside the frame, and I have it set so the MaxPlayers is 10 per server. It works when I join the actual game, but it doesn't work in studio, and I have the error that is printed in the output above.

8 comments
Ok, it does work, but a slight problem. If I am on the server it has my name, but if my friend joins, their name doesn't add onto the list for me?
I'm not sure if it's just studio, but now when I test it, it works for player1, but nothing appears on player2s screen? Does it only work in actual game servers and not the studio servers?
And another problem, it doesn't work in online mode
It only seems to work when a second player joins :/
added update() to line 14
Works! Thank you!!
One last question, if I do players[number] that returns the player who joined, but nil for the other 9 spots. I'm trying to make it so if a player joins witha certain name they get different colored text. I edited my question with what I have but it doesn't work :/
Wait nvm, think I got it