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)
