Help for a 'HeightBar' GUI similar to the game Tower Of Hell [Video + script]

Hello, I am having difficulties to code the player’s progression in the GUI ‘HeightBar’ correled to the character progression inside the tower. The script seems to be almost functional but there is still a gap between the player on the GUI and the player in the tower. I don’t know how to fix this problem.

On the right side of the video you can see the progression of the Player GUI in the heightBar correled to the chacater progression inside the tower.

Video :

Script :

local distance = workspace.Tour.Depart.Toujours.Start.Position.Z - workspace.Tour.Fin.Toujours.FauxTriangle.Position.Z 
local function generateTemplate(plr2)	
	if plr2.Character and plr2.Character:FindFirstChild('HumanoidRootPart') then	
		local plrTemplate = PlayerGuiTemplate:FindFirstChild(plr2.Name)		
		if not plrTemplate then	
			plrTemplate = Template:Clone()
			plrTemplate.PlayersImage.Image = 'https://www.roblox.com/bust-thumbnail/image?userId='..plr2.UserId..'&width=420&height=420&format=png'
			plrTemplate.Name = plr2.Name
			plrTemplate.Visible = true
			plrTemplate.Parent = PlayerGuiTemplate
		end		
		local playerDistance = plr2.Character.HumanoidRootPart.Position.Z - workspace.Tour.Depart.Toujours.Start.Position.Z
		plrTemplate.Position = UDim2.new(0.954,0,1-(playerDistance/-distance),0)				
	end
end

Here distance = The Start of the Tower Position.Z - the End of the Tower Position.Z