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.