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

How can I have a player teleport to another game when they die?

Asked by 5 years ago

I'm making a horror game and there are 2 places, the start place, and the game place. I want it so that when you die in the game place, you are brought back to the start place. I've tried almost everything yet it keeps failing for me, can somebody help me out?

The script that I was using which isn't working is:

local player = game.Players.LocalPlayer

player.Character.Humanoid.Died:connect(function()
game:GetService('TeleportService'):Teleport(2094965912, player)
end)

1 answer

Log in to vote
0
Answered by
hopup 15
5 years ago
game.Players.PlayerAdded:connect(function(player)
    player.CharacterAdded:connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()
            game:GetService('TeleportService'):Teleport(2094965912, player)
            print("Teleporting")
    end)
    end)
    end)

This should fix it, put it in a local script because it doesn't seem to work in a regular script.

0
And you didn't bother to explain? User#19524 175 — 5y
0
@incapaz IKR Zenith_Lord 93 — 5y
Ad

Answer this question