local function y(y,w)local s=VipDoor.CFrame.p-Vector3.new(0,VipDoor.Size.Y/2,0)local X=s+VipDoor.CFrame.lookVector*8 local H=s-VipDoor.CFrame.lookVector*8 local K=(X-w.Position).magnitude local c=(H-w.Position).magnitude if K<c then y:MoveTo(H)else y:MoveTo(X)end end

local function TeleportToOtherSide(character, hitPart)
	local bottomOfDoor = VipDoor.CFrame.p - Vector3.new(0, VipDoor.Size.Y / 2, 0)
	local inFrontOfDoor = bottomOfDoor + VipDoor.CFrame.lookVector * 8
	local behindDoor = bottomOfDoor - VipDoor.CFrame.lookVector * 8
	
	local distanceToFront = (inFrontOfDoor - hitPart.Position).magnitude
	local distanceToBack = (behindDoor - hitPart.Position).magnitude
	if distanceToFront < distanceToBack then
		character:MoveTo(behindDoor)
	else
		character:MoveTo(inFrontOfDoor)
	end
end
