This script is supposed to be invisible at first, but every time someone dies, it's supposed to be visible. The first time you die, it works, but if you keep dying it won't work. Can someone help me figure out why it doesn't work every time you die? Thanks.
G = script.NotificationGui
F = G.Main
T = F.PText
S = script.Sound
function appear()
local P = game.Players:GetPlayers()
for i=1, #P do
local newg = script.NotificationGui
newg.Parent = P[i].PlayerGui
end
end
function disappear()
local P = game.Players:GetPlayers()
for i=1, #P do
local newg = script.NotificationGui
newg.Parent = P[i].workspace
end
end
function Died(player)
F.Visible = true
print("Player Died")
T.Text = (player.Name.." died.")
appear()
wait(5)
F.Visible = false
disappear()
end
game.Players.ChildAdded:connect(function(newPlayer)
newPlayer.CharacterAdded:connect(function(Character)
wait(0.01)
Character.Humanoid.Died:connect(function() Died(Character) end)
Died()
end)
end)

2 comments
You're placing it in the Player's PlayerGui but not the StarterGui so it will not show up again when they respawn. Putting it in the StarterGui will make it visible for all players though.
ResetPlayerGuiOnSpawn defaults to false I believe, so FearMeIAmLag is incorrect. Whatever is placed in the PlayerGui stays there unless you change it.