Recently i’ve beed making a game in which there are portals and when you go inside it brings you to a different level ( it has the same concept as Speed Run 4) I decided to use clockwork’s teleport script, but it seems to have a problem. If the player uses the teleport once and then resets he will not be alble to use it again which seems pretty wierd. I am a very bad scripter so I may have made a few mistakes.
Here is the script:
local Teleport = "Part1" 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.