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

How to make another object make it so a different part can make the player teleport to another part?

Asked by 5 years ago
Edited 5 years ago

I want to figure out how to make a part named "End" triggered when collided makes it so another part named "Part1" can teleport a different player to a part named "Start" but when a player teleports to Start another player cant unless a player collides with "End."

Here is my script, It didn't work:

local parent = script.Parent.Parent.Part1.Script.Parent

local Teleport = "PartStart"
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)
        hit.parent:moveTo(Pos.Position) wait(1) script.Parent.Locked = false script.Parent.Parent:findFirstChild(Teleport).Locked = false end end
script.parent.Touched:connect(Touch) 

Please fix it/tell me what I did wrong. Thanks!

Answer this question