Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to I fix this teleporter on touch?

I am making a new game Code Hunters 2 opening tomorrow and I am making teleporters so you don't lose your collections. I really need help scripting a teleporter, and I stink at scripting so I used 1 free model and edit some stuff around and here is what I ended up with. Please help me where when u touch a part it teleports you!

NOTE: PLEASE REMAKE THIS SCRIPT IF YOU CAN IF YOU DON'T WANNA PLEASE EDIT IT! I AM IN DESPERATE TIMING WITH MY GAME OPENING TOMORROW!

local Teleport = "SpawnA" --Put the name of the Part between the ""s.
function Touch(hit) --Indicates that the Part has been Touched.
	if script.Parent.Locked == false and script.Parent.Parent:findFirstChild(Teleport).Locked == false then script.Parent.Locked = true script.Parent.Parent:findFirstChild(Teleport).Locked = true --Checks Debounce.
	local Pos = script.Parent.Parent:findFirstChild(Teleport) --Gets the Part to teleport to.
		hit.Parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end --Takes you there and Ends the Function.
script.Parent.Touched:Connect(Touch) --Listens out for Touchers.

1 answer

✓ Accepted answer

Put this inside of the part in a Normal Script:

local SpawnA = CFrame.new(138.25, 0.5, 98.15) --Put the coordinates (aka position) of your Part "SpawnA" here
script.Parent.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.Character.Torso.CFrame = SpawnA + Vector3.new(0, 5, 0)       
end)
--pyccknnxakep

Please Upvote and Accept Answer if this helped so if others encounter the same problem you have they can reference from here.

This discussion is preserved as it was. New answers, comments, and votes are closed.