I have 2 parts that teleport the player to other parts, i have this script in both of the tp parts,
local Teleport = "roomEntrance" -- Part where the player teleports to, CanCollide is off
function Touch(hit)
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
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)
Theres a problem where when the player teleports, it teleports above the ceiling instead of inside the room. Help is appreciated!

1 comment
use code blocks plesae