How do I find how close two guis are from each other

image

Hi, I want to make a script that tells the distance between the arrow and the star on a scale of 0 to 1. 0 is in the red and 1 is exactly on the green. I’m not sure how I would achieve this, I thought about adding the x values together but then I remembered if its on the left it’s a negative, so I assume it with have to use math.abs (finding the aboslute value of a number)

Thank you - BMWLux

2 Likes

local distance = math.abs(arrow.Position.X.Scale - star.Position.X.Scale)*2

1 Like

You can use the absolute position and size, along with some math, to find this.

2 Likes

Thank you so much this solved the issue perfectly!

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.