Client ScreenGUI only updates after respawning

  1. What do you want to achieve?
    I am trying to update a screengui on the client side. The screengui shows the player name and their points in respective text labels. The name is updated when the player touches a part in game and the points are manually given each time I press a button in game.

  2. What is the issue?
    The issue is that the screengui will only update on the server but not on the client UNLESS the player respawns.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    The only “solution” or update to my problem was that I swapped the screengui with a surface gui and it appears to work on there on the client side but when I use the screengui i have to respawn to see it update.

This is my touch part scripts to get the player name in a text label in the screengui. The local script is in the StarterGui and the server script is in the ServerScriptService.

-- Local script

local TouchPart= game.Workspace.Scale.RightScale.TouchPart

TouchPart.Touched:Connect(function()
	game.ReplicatedStorage.RightNameFunction:InvokeServer(TouchPart)
end)
-- Local script

local R1= game.Workspace.Scale.R1

R1.ClickDetector.MouseClick:Connect(function()
	game.ReplicatedStorage.RightScoreFunction:InvokeServer(R1)
end)

This is my button scripts to update the player points in the a label in the screengui. The local script is in the StarterGui and the server script is in the ServerScriptService.

-- Local script

local TouchPart= game.Workspace.Scale.RightScale.TouchPart

TouchPart.Touched:Connect(function()
	game.ReplicatedStorage.RightNameFunction:InvokeServer(TouchPart)
end)
-- Server script

game.ReplicatedStorage.RightScoreFunction.OnServerInvoke = function(player,code)

	local Score = game.StarterGui.RightPlayer.Frame.ScoreTextLabel
	
	Score.Text = Score.Text + '1'
end

To my knowledge, if you change a UI element on the client side and try to change the same UI element on the server side, the UI will update on the server, but not the client. Also, I am unsure about this if you can use Bindabled Functions between the server and local script, I would use RemoteEvent for this.

So should I only have a script to change the screengui on the client? And I do have remotefunctions that i used to communicate between my local and server scripts. Also im super new to scripting so my bad if I’m not explaining things properly!

Essentially that is what I am thinking the solution is. I like to keep one type of script to control changing the elements of the GUI. You can wait for other devs to reply if you want in case your script has already been embedded with local and server scripts changing the same UI.

Alrighty! And yeah I will wait to see who else comments any other ideas. In the meantime I will try to only work with the local scripts and not use server scripts for this and see how it goes. Thanks!

1 Like