I have a race like game where I use a trigger part to signal the end and show the winner. FE is enabled.
When the part is touched it sends an remoteevnt to the server with the winners name then the server sends a fireallclient to stop the race and show who won.
I kept getting an invalid playergui error but the message was showing up. So I did some test and for some reason each client is trying to update the playergui for all players.
I have just ruined it on test with two players. Player1 will update its player gui and give an error that player2 gui is invalid and player2 will update its gui and give an error that player 1 gui is invalid.
Not sure what is gong on I deconstructed my code to check if it was an interaction but get the same problem. Once I get home I can post the code if necessary, I just can keep my mind off this problem.
Trigger:
local Players = game:GetService("Players")
local localplayer = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local timerGUI = localplayer.PlayerGui.timerGui.timerLabel --where time will be displayed
local endGameEvent = ReplicatedStorage:WaitForChild("endGameEvent")
function startTimer()
local DEBOUNCE = false --off switch debouncer
workspace.trigger.Touched:Connect(function(hit) --when roof (aka off switch) is touched
if not DEBOUNCE then --so off switch work only once
if hit.Parent:FindFirstChild("Humanoid") then --if touched by a humanoid
print('touched')
DEBOUNCE = true --disable off switch
endGameEvent:FireServer(hit.parent.Name) --tell server game ended [server]
end
end
DEBOUNCE = false --disable off switch
end)
end
startTimer()
Server:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local endGameEvent = Instance.new("RemoteEvent", ReplicatedStorage) --create remove event for signaling end of game on server
endGameEvent.Name = "endGameEvent" --name remote event
local clientsEndGame = Instance.new("RemoteEvent", ReplicatedStorage) --create remove event for server to signal all clients that the game has ended
clientsEndGame.Name = "clientsEndGame" --name remote event
local function onGameEnded(player, winnerName)
print('winner_server:: ' .. player.Name)
clientsEndGame:FireAllClients(player, winnerName) --signal all clients to stop and display winner [client_server]
end
endGameEvent.OnServerEvent:Connect(onGameEnded) --client signaled game has ended and sent winners name
Clients:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local localplayer = Players.LocalPlayer
local clientsEndGame = ReplicatedStorage:WaitForChild("clientsEndGame") --server trigger for ending game and sending who won
local playerGui = localplayer:WaitForChild("PlayerGui")
local function onNewPlayerFired(player, winnerName)
print("print winner name: " .. player.Name)
local timerGUI = player.PlayerGui.timerGui.timerLabel
timerGUI.Text = winnerName .. " Wins!!!" --changes to winner name
end
clientsEndGame.OnClientEvent:Connect(onNewPlayerFired)

3 comments
Of course the code is necessary.
What BlueGrovyle said, we cannot help you unless you give us the script.
Wishful thinking that someone had this problem before, but made it home and edit the post to add the codes, this is the stripped down version that still gives me the error.