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

How to make a person teleport to somewhere when their humanoid health is 0?

Asked by 5 years ago

here is the script I tried to use:

if H.Health == 0 then game:GetService("TeleportService"):Teleport(736802287,player) --replace the numbers with your place id end end

but it didn't work

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

If you put this code in a Local script then it should work. Please note I put mine in the Players StarterCharacterScripts

game.Players.LocalPlayer.Character.Humanoid.HealthChanged:connect(function(Health)
    if Health == 0 then
        game:GetService("TeleportService"):Teleport(736802287,game.Players.LocalPlayer)
    end
end)

Alternatively, another script has been posted on a similar question.

Ad

Answer this question