Hey, there is a much easier method!

So what you can actually do is just normalize the value that the player is currently at between the two points you want, and then used that normalized value to position the players headshot thumbnail on the bar using scale

If you dont know what normilization is it’s when you transform a numerial value into a certain range for example [0-1]

For your use-case I’m guessing you have two points, a starting point and an ending point, and of course where your player is currently positioned. I’m going to use dummy values but you get the idea

```
function normalizePosition(currentPos, startPos, endPos)
local direction = (endPos - startPos).unit
local displacement = currentPos - startPos
local distanceStartToEnd = (endPos - startPos).magnitude
local normalizedValue = displacement:Dot(direction) / distanceStartToEnd
return math.clamp(normalizedValue, 0, 1)
end
local currentPlayerPosition = Vector3.new(0, 50, 0)
local startingPoint = Vector3.new(0, 1, 0)
local endingPoint = Vector3.new(0, 100, 0)
```

In the first function we are getting the direction of the end position to the start position and then normalizing that value and then we get the displacent of our players current position minus the start position, then we calculate the distanceStartToEnd by getting the magnitude of the end position and start position, then finally we get our normalized value by taking the dot product of the displacement using the direction and then dividing that by our distanceStartToEnd and we return a clamped value so it doesnt go out of bounds when we set the thumbnails position later

After that I define some dummy values for the currentPlayerPosition, starting point and the endpoint

Now we can just get our normalized position by calling the normalizePosition function and setting it to a variable

```
local normalizedPosition = normalizePosition(currentPlayerPosition, startingPoint, endingPoint)
print(normalizedPosition) -- .494949
```

It would print pretty much .5 because if you look at the three Vectors have, just to make it easy I only put values in the Y for each vector so it would be more noticably clear that if you take 50 / 100 you will get .5 which is our currentPosition and endingPosition respectively

Now with our normalized value we can set the position of our avatar headshot thumbnail to that value and it will show us the accurate distance from our positions in the 3D space, but make sure to use scale on the bar and also the thumbnail!