Find Relative Distance

Im trying to get the humanoidRootParts distance from another part based on the X axis relative to the humanoidRootPart. I tried doing part.Position.X - HumanoidRootPart.Position.X but that only works for the global X axis instead of relative.

look into CFrame, ToObjectSpace
I am not a pro at it, but that is how you can get the position of one part in local space to another part.

(part1.Position - part2.Position).Magnitude gives the distance between in studs.