How to get correct distance with negative numbers?

Im trying to detect the similarity between 2 things with an x position, but if there in the negatives it messed it all up, any help?

if (xrandom - character.HumanoidRootPart.CFrame.X) > 80 then

Have you considering using math.abs() or is this not an option?

1 Like

if im being honest not quiet sure what it is, let me look real quick.

how would I go about using it in my code?

if math.abs(xrandom - character.HumanoidRootPart.CFrame.X) > 80 then

math.abs will always give a positive result, as its the absolute value.