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

How to teleport a player when he dies? [closed]

Asked by 4 years ago
Edited 4 years ago

We need a script that will teleport the player every time he dies. Can this be done? How?

0
Do you want to teleport the player when he respawns or when he is still dead? Yukogan 72 — 4y
0
This is not a request site. ScuffedAI 435 — 4y

Closed as Not Constructive by ScuffedAI and Ziffixture

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by
Yukogan 72
4 years ago
Edited 4 years ago

This should work:

local tp = game.Workspace.teleport -- Where your teleport point is.

game.Players.ChildAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:Connect(function()

            character:MoveTo(tp.Position)

        end)
    end)
end)
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
-- you need to get humanoid of died player first
-- teleport is point where's you want your player teleport to
teleport = game.Workspace.teleport
humanoid.Died:Connect(function()
    wait(5) -- wait untill player reset
    humanoid.Parent.HumanoidRootPart.CFrame = teleport.CFrame
end)