Calculate Distance from Part Scripts

How do I make a gui at the top of the screen showing how close a player is to a finish?

Example: The GUI in this game

How do I program this to make the player’s gui move closer to the end as the player in game gets closer to the end part?

Use a proportion.

Let x = distance between player and end
Let h = distance between player and end when player is at start (maximum)
Let r = size of the frame

Frame.Fill.Size = UDim2.fromScale((x/h)*r, 1);

// Same technique as a position

Frame.PlayerIcon.Position = UDim2.fromScale((x/h)*r, 1);
2 Likes

Thank you so much, you don’t even know. :pray:

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