How would i find the player position in 3D space towards a part position correctly

You can write your topic however you want, but you need to answer these questions:

  1. **What do you want to achieve?**So i want to always see if the part X position value is greater or lower than the player hrp X position

  2. What is the issue? So the climb works fine like here
    https://gyazo.com/655c234871e4bafa23afd6b058cf75ee
    until u try going around a corner and now it actually changes the z value, but yet my script chooses the easier way and just plays the right boost animation instead of left boost cuz the X value of ledge is greater than the X of hrp position
    https://gyazo.com/fdafc48a0aef827f8519907be95abd01

  3. What solutions have you tried so far? Trying to check for Z value and then for the X

https://gyazo.com/585a4dbe5040c6528f90890eccc1b65e like here it changes the Z yet the X is greater so it chose to play rightboost instead
https://gyazo.com/9f2546a555e07598d8ebbd16abedeccc heres the code for it
if u have any better method i could use instead of using cframe please tell me (i dont think raycasting is a good one here since i use mouse position)

I would try getting the position it would move the player to, then use :ToObjectSpace() to get the position relative to the player.

PositionCF:ToObjectSpace(rootpartCF) and base the animations based off the coordinates given from that.

hm ill try that in a bit ill say tmrw how it goes

Used this thing and it worked out
x = hrp.CFrame.RightVector((Ledge.Position - hrp.Position).Unit)
and then i checked if its below zero for left side and above for right
https://gyazo.com/02e8a1aabb3d3fb453377f21900bd7e6

heres climb in work [Roblox Studio] Climb showcase - YouTube