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

Is there a way to detect if player died?

Asked by
DesertusX 435 Moderation Voter
4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago

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)
0
Thank you. :) DesertusX 435 — 4y
Ad

Answer this question