(my other question got deleted and idk why...) Chess123mate edited my script and this is what he did. Why isnt this working? The script is supposed to get each player's name inside a text label. It doesnt say anything in output and the player names arent shown.
local lobby = game.StarterGui.MainGui.MenuButton.Lobby
game.Players.PlayerAdded:connect(function(player)
local ch = game.Players:GetPlayers()
for i = 1, #ch do
lobby["Player" .. i].Text = ch[i].Name
end
for i = #ch + 1, 16 do --clear the unused TextLabels
lobby["Player" .. i].Text = ""
end
end)
btw the script is inside the textlabel = startergui.mainGui.menuButton.Lobby.Player(txtbutton).PlayerName(txtlabel) I have 16 txt buttons and 16 text labels to show the names of players in the game.

4 comments
Why do you have a "Player" TextButton and a "PlayerName" TextLabel? Are the TextButtons named "Player1" through "Player16", or are they all named "Player"?
They are named Players 1-16 and i have a text label inside the text button to make the gui text look better.
I am assuming that you want it so when a player joins, it'll create/change a textlabel inside of all of the players' guis that has that player's name on it. The best way to accomplish this is through remoteEvents
Any solutions to the above question? Im not saying that the input wasnt good, but I really want to find out this script's problem