Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to detect when a players humanoid died?

Asked by 10 years ago

Hello I am having trouble, I'm trying to detect when a players humanoid died, but I don't know how, can someone help me please? Thanks! :D

1 answer

Log in to vote
1
Answered by 10 years ago

Use the Died Event. Here's an example:-

-- This script makes a message in the server when a player dies, like if I died then a message will appear saying "kudorey619 has died!"
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

For more information: http://wiki.roblox.com/index.php/Died_(Event)

1
Small note though. I'm not sure if ROBLOX has fixed this recently, but as of the last time I checked, the Humanoid.Died event doesn't work. The best work around I've seen is a while loop that checks if the player's health reaches 0. (basically a manual Died event) deaththerapy 60 — 10y
1
Thanks for the information! kudorey619 138 — 10y
Ad

Answer this question