TextLabel not visibly updating text after script changes it

I have a server script that is meant to change the text of a textlabel to a players username, everything works fine, and the script is doing what it’s supposed to, in the properties of the textlabel, the text has changed to the players username but the physical gui on the screen won’t change. Why is that?

local ct = game.ReplicatedStorage:WaitForChild("ChangeTeam")
local Menu = game.StarterGui.Menu

ct.OnServerEvent:Connect(function(player, change)
	print(change.Name)
	if game.Teams:FindFirstChild(change.Name) then
		
		local TeamNum = Menu:WaitForChild(change.Name)
		local Count = TeamNum:WaitForChild("Value")	
		
		local User1 = TeamNum:WaitForChild("Username 1")
		local User2 = TeamNum:WaitForChild("Username 2")
		local User3 = TeamNum:WaitForChild("Username 3")
		
			Count.Value = Count.Value+1
		player.Team = game.Teams:FindFirstChild(change.Name)					
		
		if User1.Text == "Username" then
			User1.Text = player.Name
			print("User1 Changed")
		elseif User2.Text == "Username" then
			User2.Text = player.Name
			print("User2 Changed")
		else 
			User3.Text = player.name
			print("User3 Changed")
		end
		
	end
end)

Solved it, didn’t realise I had to change the TextLabel via a local script in the GUI.

Another reason why this did not work is because the script was changing the text in StarterGui, not in any currently online player’s actual Gui.

It would’ve worked just fine if it modified the text in every player’s PlayerGui.

Firing a server → client remote and letting the client update the text locally is also fine, which is what you might be doing now.

1 Like

You do not have to change the text label via a local script, like @Eestlane771 said, if you change a text label, or any ui element from any type of script that isn’t in *StarterGui *or one of its Descendants, you will have to update the players PlayerGui and not StarterGui, because as soon as the player joins the StarterGui contents get cloned in to the Players PlayerGui and they no longer see any changes to the StarterGui