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

I need help with my teleporter script?

Asked by 9 years ago

I need to make multiple teleporters for my game, and I can't figure out how to move the body of the player somewhere without killing it. I need help with the script.

2 answers

Log in to vote
0
Answered by 9 years ago

I don't know what type of trigger you are doing.(if its clicking a gui then teleport or stepping on a brick then teleport) I will guide you through the brick one because it is more common.

Spawn 2 bricks. One named Tel1 another Tel2. What would happen is when you touch Tel1, you teleport to Tel2. Put the script inside of Tel1 and group both parts(Tel1/2) together.

local Tel1 = script.Parent--Our parenting part. The part we first touch.
local Tel2 = script.Parent.Parent.T2--The part we teleport to
function onTouch(Brick)--Starts the function.

local Player = Brick.Parent:findFirstChild("Humanoid")--finds the humanoid
if(Player ~=nil) then--checks if player is a real player
Player.Parent.Torso.CFrame = CFrame.new(Tel2.Position+Vector3.new(0,3,0))
end
end
Tel1.Touched:connect(onTouch)--Connection line
Ad
Log in to vote
0
Answered by 9 years ago

just try to use the CFrame on their torso, then they will not die.

Answer this question