So I'm making this elevator which goes up and down and it works but I want it to rotate at the top to be at the same angle as the top floor. 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)