CFrame:PointToObjectSpace() not working as it should

Hello,so I have this doors that opens according to where you at, and I used CFrame:PointToObjectSpace()
So what it’s doing:
https://gyazo.com/7b65b53723dadeaa7efb3997f24d5f33

https://gyazo.com/17019d77b3a03bac8b4673ea5a944987
But sometimes is not working right here’s code:


					v.Moving.ClickDetector.MouseClick:Connect(function(Player)
		local Position = v.Moving.Door.CFrame:PointToObjectSpace(Player.Character.HumanoidRootPart.Position)
	
		if v.Open.Value == false then
			v.Open.Value = true
			if Position.Z > 1 then
				
					v.Moving.Primary.Motor.DesiredAngle = 1.4		
					v.Moving.Primary1.Motor.DesiredAngle = -1.4	
				elseif Position.Z  < 1 then

					v.Moving.Primary1.Motor.DesiredAngle = 1.4	
				v.Moving.Primary.Motor.DesiredAngle = -1.4
			end
		elseif v.Open.Value == true then
				v.Moving.Primary.Motor.DesiredAngle = 0
				v.Moving.Primary1.Motor.DesiredAngle = 0
				v.Open.Value = false
			end
		end)

image

It’s doing exactly what you programmed it to do. PointToObjectSpace isn’t the problem.

Other than this comment, not quite sure if I can adequately help you here. Do you have a reference or way to visualise what’s occurring here? That’ll be beneficial to helping you see where things are going, if you’re at an absolute loss for how to do this.