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.
You can use the .Died
RBXScriptSignal of Humanoid
to create an event upon the affiliated Player “dying”.
1 | local Player = game:GetService( "Players" ).LocalPlayer |
2 | local Character = Player.Character or Player.CharacterAdded:Wait() |
3 | local Humanoid = Character:WaitForChild( "Humanoid" ) |
4 |
5 | Humanoid.Died:Connect( function () |
6 | print (Player.Name.. " Died" |
7 | end ) |