--Functions

function open()
	local mag = (doora.PrimaryPart.Position-script.Parent.Parent.Ahit.Position).magnitude
	for j = 0,1,speed/mag do
		local scf = doora.PrimaryPart.CFrame
		doora:SetPrimaryPartCFrame(scf:lerp(script.Parent.Parent.Ahit.CFrame,j))
		wait()
local magg = (doora.PrimaryPart.Position-script.Parent.Parent.Ahit.Position).magnitude
if magg <= 0.1 then break end
	end
end
function close()
	local mag = (doora.PrimaryPart.Position-script.Parent.Parent.OrigAhit.Position).magnitude
	for j = 0,1,speed/mag do
		local scf = doora.PrimaryPart.CFrame
		doora:SetPrimaryPartCFrame(scf:lerp(script.Parent.Parent.OrigAhit.CFrame,j))
		wait()
		local magg = (doora.PrimaryPart.Position-script.Parent.Parent.OrigAhit.Position).magnitude
if magg <= 0.1 then break end
	end
	doora:SetPrimaryPartCFrame(doora.PrimaryPart.CFrame:lerp(script.Parent.Parent.OrigAhit.CFrame))
	end