How can I get the X position of a object compared to the X position of another object?

I am making a climbing system, I cant figure out how I can make the player teleport to the current X cframe of the player compared to the object, it just teleports to the middle… does anyone know how to fix it?

‘’’
local pos = player.Character:GetPivot()

player.Character:MoveTo(part.Position)
player.Character:PivotTo((part.CFrame + part.CFrame.LookVector * -2) - Vector3.new(0,1,0))
‘’’

1 Like

Any time you ‘compare’ or ‘get the difference’, it’s subtraction. pos1.X - pos2.X

1 Like

Yes… but when I do that it just puts the player somewhere else. I want to make the Player stay on the same X cordinate Cframe


The one on the left is where I want him to be, and the one on the right is where he goes… The arrow represents the jump; the circle represents the player after and before a jump