You are changing the text of the textlabel in starter gui, not the one of the player,
1 | local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName |
2 | local Player = game.Players.LocalPlayer |
3 | local UserName = Player.Name |
5 | game.Players.PlayerAdded:connect( function () |
6 | TextLabel.Text = UserName |
If you change the startergui one, it will show the players name when they refresh their gui, or when a new player joins, their gui will say the old username
What I think you want to do is change the text of the player that joined textlabel, to do that you would just do this instead,
1 | local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName |
3 | game.Players.PlayerAdded:connect( function (p) |
4 | p.PlayerGui.GameplayGui.PlayerInfo.PlayerName.Text = p.Name |
Hope this helped, if it did, accept the answer it gives us both rep!