local maxDistance = 12 -- The furthest distance the clock will ever be away.
local desiredTime = 14
local getNumber = function(clockTime)
local distance = math.abs(desiredTime - clockTime)
local percentAway = distance/maxDistance -- Will give you 1 for 100% away and 0 for directly ontop of.
local percent = math.abs(percentAway - 1) -- Reverts it around, giving you 1 for 0 and 0 for 1.
return percent
end
Hope this has the effect you are looking for.
Note - There probably are more efficient ways to do this math.