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

How would i make a script that runs when anyone dies in the game?

Asked by
Anto3oo 13
3 years ago

So basically i want to make a script that deletes their character as soon as they die , but i don't even know where to start, i investigated and the only thing i've got is Humanoid.Died, but i want to script this so this works with anyone that has died, thank you.

1 answer

Log in to vote
0
Answered by 3 years ago

I think if I understood what you're trying to accomplish a little better I could be of more help, but I would use the Humanoid.Died event as you mentioned.

game:GetService('Players').PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()
            character:Destroy()
        end)
    end)
end)
Ad

Answer this question