Changing SurfaceGui when player leaves

This is meant to change the “screen” on the SurfaceGui when a player leaves so another player can use it. I’m probably doing something wrong, but it’s not blatantly obvious to me. All it does is changes for the player that leaves (if they rejoin of course, they’ll see it or if not, they won’t see a change, obviously) but not for the other players still online.

This is the local script (located as a descendant under the surfacegui)

local SD = game:GetService("ReplicatedStorage").Events.StaffDisconnect

game.Players.PlayerRemoving:Connect(function()
	if Player.Name == su1.Value then
		su1.Value = ""
		screen1.Visible = true
		screen2.Visible = false
		SD:FireServer()
	else return
	end
end)

SD.OnClientEvent:Connect(function(staff)
	screen1.Visible = true
	screen2.Visible = false
end)

And on the server (ServerScriptService):

local RE = game.ReplicatedStorage.Events.StaffDisconnect

RE.OnServerEvent:Connect(function(player)
    RE:FireAllClients(player)
end)

Thanks in advance. :slight_smile:

instead of using values to compare strings use tables
secondly how do you expect the script to know what su1 is at all ?
You need to define that first in a variable .
or it would give an error
also you don’t need any events you can handle disabling/enabling a surface gui through one script after a player leaves.
I dont understand the need to do this in the first place ,

My bad, forgot to include all the variable definitions in the code snippet.

su1 is is a StringValue, and it IS defined in the script that it is required to be used in.
Could you elaborate on what you mean by “compare strings use tables”? I’m not exactly sure what you mean by this.

Read my post over here, as I said, communicating between client to server to client again is a bad practice (or vice versa)

Okay. If I stick with this way (for now, if it’s bad practice then I’ll work on changing it), how would I get it to function properly?