Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to detect if player died?

How could I know if a player died and use it in an if statement. In my game, every time a player dies, a point will be given to the other team. Is there a way to do this? Thank you for trying to help.

1 answer

✓ Accepted answer

You can use the .Died RBXScriptSignal of Humanoid to create an event upon the affiliated Player “dying”.

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

Humanoid.Died:Connect(function()
    print(Player.Name.. " Died"
end)

1 comment

0

Thank you. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.