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

How can I use TeleportService to teleport somebody to a separate game when they die?

Asked by 6 years ago

So I want to make a teleporter that teleports the player when they die. I should be able to do this, but I have no idea on how to store the dead player in a variable. I've tried googling it but nothing comes up related to my question, so I'm asking it here. Can anyone help?

0
You don't need to if you use CharacterAdded, it fires when a player respawns or gets a new character. ABK2017 406 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

try using the Died() event

Ad
Log in to vote
0
Answered by
ABK2017 406 Moderation Voter
6 years ago

Here is an example...This assumes you already have a Player and Start variable defined somewhere. Also you may need to change the workspace location for your needs. But since CharacterAdded fires on player respawn or player getting a new character, you don't necessarily need a Died event...Hope this is helpful!

Player.CharacterAdded:Connect(function(character)
    if start == false then
        print("They Shall Not Pass")
        character:WaitForChild("Torso").CFrame = CFrame.new(workspace.Lobby.Spawns.Part.Position) -- The wait for child is just in case of lag.
    end
end)

Answer this question