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

is there any function that detects if a player dies or resets?

Asked by 3 years ago

So yeah thats basically it, thanks

1 answer

Log in to vote
-1
Answered by 3 years ago
Edited 3 years ago

Yes, and It's a event of Humanoid called .Died.

You can use this event in both server and client script.

Example:

local Players = game:GetService('Players')

Players.PlayerAdded:Connect(function(plr))
  plr.CharacterAdded:Connect(function(char)

  repeat task.wait() until plr.Character -- checks when character is child of player.

  char.Humanoid.Died:Connect(function()
    print('player '..plr.Name..' died!'
    end)
  end)
end)


Ad

Answer this question