How can I make a script where a script will run when the player dies? ex: when that player dies a script will run or just print(yes)
maybe like an OnDiedScript or something Like that.
How can I make a script where a script will run when the player dies? ex: when that player dies a script will run or just print(yes)
maybe like an OnDiedScript or something Like that.
A more polished version of the answer above me. (Assuming you've allready set a "Player" value.)
local Humanoid = Player.Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
print(Humanoid.Parent.Name .. " has died.")
end)
game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function() this will run once the local player has died
where do I put the script?
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
humanoid.Died event listener in the script you want to run