local function g(g,R)local Z=VipDoor.CFrame.p-Vector3.new(0,VipDoor.Size.Y/2,0)local j=Z+VipDoor.CFrame.lookVector*3 local O=Z-VipDoor.CFrame.lookVector*3 local w=(j-R.Position).magnitude local h=(O-R.Position).magnitude if w<h then g:MoveTo(O)else g:MoveTo(j)end end
-- Finds out which side the player is on and teleports them to the other
local function TeleportToOtherSide(character, hitPart)
	local bottomOfDoor = VipDoor.CFrame.p - Vector3.new(0, VipDoor.Size.Y / 2, 0)
	local inFrontOfDoor = bottomOfDoor + VipDoor.CFrame.lookVector * 3
	local behindDoor = bottomOfDoor - VipDoor.CFrame.lookVector * 3

	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
