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

Help on my rotating elevator?

Asked by
Zelnus 30
8 years ago

So i am making an elevator which goes up and down but at the top it rotates to match the top blocks CFrame. This is what I have:

Active=false

local main=script.Parent.Parent.Elevator
local pa=script.Parent.Parent.PointA
local pb=script.Parent.Parent.PointB


function onTouch()
    if Active==false then
        Active=true
        main.BodyPosition.position=pb.Position
        main.BodyGyro.CFrame = pb.CFrame
        wait(5)
        main.BodyPosition.position=pa.Position
        wait(1)
        Active=false
    else
        wait()
    end
end
script.Parent.Touched:connect(onTouch)

Answer this question