Make the text visible to others players except for you

Howdy Devs!

I got a script that whenever a player dies it informs
the server that they died. But the problem is when you die (the client) your name pops up on your screen. The thing I want to achieve is when you die your name pops up on the server everybody on the server can see it except for you.

local function Died()
	for _,p in pairs(game.Players:GetPlayers()) do
		local Gui = script.PlayerDiedGui:Clone()
		Gui.Parent = p.PlayerGui
		Gui.TextLabel.Text = script.Parent.Name.. " Died"
		Gui.Script.Disabled = false
	end
end

script.Parent.Humanoid.Died:Connect(Died)

Toolboxed

Check if the current player in the loop is not you

You can do so with an if statement something like this, assumign script.Parent is the character

if p == game:GetService("Players"):GetPlayerFromCharacter(script.Parent) then
    continue
end
-- Code to show the gui

If the current player is your player, we continue to the next player

Ok, Its been a while but I think this is helpful enough for me, sorry for the late reply😅

1 Like