Offset Scripting Issue

Hi! I am wanting to make a player the can move from the start (yellow) to the end (green) and the trophy represents the finish. I want the gui at the top to move with the player.

I wrote this script that is making it so it works when you get to the end, the gui is over the trophy, but when you move to the yellow, the gui goes to the middle not to the other end

- This is what it looks like when you are at the start. I want the gui to be all the way over to the left side. Any way I could fix this? Thanks - Lux

Here is my current code :arrow_down_small:

local player = game.Players.LocalPlayer
local char = player.Character
local HRP = char:WaitForChild("HumanoidRootPart")
local Finish = game.Workspace.Map.Points.Finish
local Start = game.Workspace.Map.Points.Start
local ts = game:GetService("TweenService")
local HB = game:GetService("RunService")
local ti = TweenInfo.new(0.1, Enum.EasingStyle.Quad, Enum.EasingDirection.In, 0, false, 0)
HB.Heartbeat:Connect(function()
	wait()
	local Dis = (HRP.Position - Finish.Position).Magnitude
	local OtherDis = (Start.Position - Finish.Position).Magnitude
	local PercentOf = Dis/OtherDis
	local Hi = 1 - PercentOf
	local Max = 1.75 * Hi
	local tween = ts:Create(script.Parent.Player, ti, {Position = UDim2.new(Max, 0,0.234, 0)})
	tween:Play()
end)

You can set the position of the player icon to “scale” (so it becomes a value from 0 to 1, 0 representing start and 1 representing end)

Then just set the scale value to PercentOf :smiley:
You also don’t need to use tween since it updates everytime a frame is rendered (you can remove the wait() also)