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

How to make a script fire everytime a player dies?

Asked by 2 years ago
game.Players.PlayerAdded:Connect(function(player)
    local plrname = player.Name
    local humanoid = game.Workspace:WaitForChild(plrname)
    local hum = humanoid:WaitForChild("Humanoid")

    local function onCharacterAdded(character)
    end

    player.CharacterAdded:Connect(onCharacterAdded)

        if player.Character then

        -- my code --

         end
end)

I tried using this but it only works once

1 answer

Log in to vote
0
Answered by 2 years ago

Do this:

player.Character.Humanoid.Died:Connect(function)
--Blahblah blah
end)

You can search in the wiki for that for more info.

0
aight tar Twitch_Firzyy 0 — 2y
Ad

Answer this question