-- https://devforum.roblox.com/t/lua-map-command/215342/15
-- Maps a number from one range to another:
-- [in_min, in_max] -> [out_min, out_max]
function map(x, in_min, in_max, out_min, out_max)
return out_min + (x - in_min)*(out_max - out_min)/(in_max - in_min)
end
local star: GuiObject
local arrow: GuiObject
local dist = (arrow.AbsolutePosition - star.AbsolutePosition).Magnitude
local mapped = map(dist, 0, 9999, 1, 0)