✓ Accepted answer
If you want something to occur when someone dies, just use the Died event of a Humanoid.
If you clone are cloning a GUI and don't want it when a player dies, make sure it is being cloned when the Player joins the Players and not when the Character is added into workspace.
More events of the Humanoid can be found here.
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild("Humanoid").Died:connect(function()
print(player.Name .. " has died!")
end)
end)
end)
If I have helped answer your question please remember to accept my answer. Otherwise, feel free to message me or comment on my answer on how I could have better helped. Thanks!
2 comments
Ohh i see where i did wrong. Thanks alot for commenting, i was having problems with PlayerAdded and characteradded. This really helped :)
No problem. Best of luck.