Checking if a player has driven a certain distance

Hello!

This script that I have, is theoretically supposed to be checking if a player has driven a mile and if they have, increase their leaderstats.

Apparently, the sheer small amount of distance, the script continuously removes the distance from the goal, even though it is in small amounts, it isn’t accurate which I do not like.

Any help would be appreciated.

Note: I was originally using RunService.Stepped as I thought it would be more accurate, but because of the difference in the distances, it just constantly removed it, I am having the same issue here, but at a lower interval however it does fix itself after a few seconds because of the Amount = 0 part

Script:

local Owner = script.Parent.Parent:WaitForChild("Owner").Value
local RunService = game:GetService("RunService")

local CurrentGoal = Goal


local LastPosition,Amount

while wait(1) do
	if Owner then
		local Character = Owner.Character

		if Character then
			local CurrentPosition = script.Parent.Parent.PrimaryPart.Position

			if LastPosition then
				Amount = (CurrentPosition - LastPosition).Magnitude

				CurrentGoal -= Amount
				warn("Current Position: "..tostring(CurrentPosition))
				warn("Last Position: "..tostring(LastPosition))
				warn("Amount: "..Amount.." Goal: "..CurrentGoal)

				if CurrentGoal <= 0 then
					CurrentGoal = Goal

					Owner.leaderstats:FindFirstChild("Miles Driven").Value += 1

					LastPosition = CurrentPosition
					Amount = 0
				end
			else
				LastPosition = CurrentPosition
			end
		end
	end
end

Figured it out myself, I rounded the positions so that there won’t be any difference, as well as updating the last position as soon as it’s taken away from the current goal.