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

How do I make an On-Death teleport?

Asked by 10 years ago

How do i make an On-Death teleport, I have some free ones, but none of them work. I want to have it so when Player is killed, He/She is teleported to the lobby that I have, here is one that i have.

~~~~~~~~~~~~~~~~~local Humanoid = script.Parent.Zombie function PwntX_X() local tag = Humanoid:findFirstChild("creator") if tag ~= nil then if tag.Value ~= nil then local Player = tag.Value if Player ~= nil then Player.Character.Torso.CFrame = CFrame.new(4699, 809, -134) end end end end Humanoid.Died:connect(PwntX_X)~~~~~~~~~~~~~~~~~

0
Please edit your post. Put all you code in a code block, that is, click the little blue Lua symbol and put your code between the squiggly lines it creates. Perci1 4988 — 10y
0
The squiggly lines must be on their own line, that is, ~~~~~~~ (NEW LINE) --[[code]]-- (NEW LINE) ~~~~~~ Perci1 4988 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
1game:GetService('Players').PlayerAdded:connect(function(player)
2    player.CharacterAdded:connect(function(character)
3        character:WaitForChild("Humanoid").Died:connect(function()
4wait(5.1) --5 is the average respawn time.
5player.Character.Torso.CFrame = CFrame.new(4699, 809, -134)
6        end)
7    end)
8end)
Ad

Answer this question