so i just have like a glass bridge game and want to show how far the players are with a bar
Alright, here's how I would do it.
Find the distance of the player to the distance of the player to the starting point and divide it by the distance of the starting point to the ending point.
-- this code assumes the starting point, ending point, and player are all defined local playerDistanceCovered = (player.Character.HumanoidRootPart.Position - startingPoint.Position).magnitude local totalDistance = (endingPoint.Position-startingPoint.Position).magnitude local distanceRatio = math.clamp(playerDistanceCovered/totalDistance, 0, 1)
Now that you have the distance ratio, you just need to change a GUI's size.
-- this code assumes you have your distance bar and the default size of your bar defined distanceBar.Size = UDim2.new(defaultBarSizeX * distanceRatio, 0, defaultBarSizeY, 0)
Easy as that!