local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName
local Player = game.Players.LocalPlayer
local UserName = Player.Name
game.Players.PlayerAdded:connect(function()
TextLabel.Text = UserName
end)
This is the entire script.
local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName
local Player = game.Players.LocalPlayer
local UserName = Player.Name
game.Players.PlayerAdded:connect(function()
TextLabel.Text = UserName
end)
This is the entire script.
You are changing the text of the textlabel in starter gui, not the one of the player,
local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName
local Player = game.Players.LocalPlayer
local UserName = Player.Name
game.Players.PlayerAdded:connect(function()
TextLabel.Text = UserName--TextLabel is game.StarterGui etc
end)
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,
local TextLabel = game.StarterGui.GameplayGui.PlayerInfo.PlayerName
game.Players.PlayerAdded:connect(function(p)--P is equal to the player who joined
p.PlayerGui.GameplayGui.PlayerInfo.PlayerName.Text = p.Name--Change the destination of the statements for your own script
end)
Hope this helped, if it did, accept the answer it gives us both rep!
Thank you! :D
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
So are you trying to make it so when someone else joins, the text box text would change?
Yes.