Hello. I am having issues with this script where leaderstats is underlined in blue so the script won't work. Should I have it in a local script? I currently have the script in Workspace. The script abbreviates large amounts of Cash on the leaderboard.
function Convert(num)
local x = tostring(num)
if #x>=13 then
local num1 = (#x-12)
return x:sub(0,(num1)).."."..(x:sub(#x-10,(#x-10))).."Q+" --Quadrillion
elseif #x>=10 then
local num1 = (#x-9)
return x:sub(0,(num1)).."."..(x:sub(#x-7,(#x-7))).."B+" --Billion
elseif #x>= 7 then
local num1 = (#x-6)
return x:sub(0,(num1)).."."..(x:sub(#x-5,(#x-5))).."M+" --Million
elseif #x>=4 then
return x:sub(0,(#x-3)).."."..(x:sub(#x-2,(#x-2))).."K+" --Thousand
else
return num
end
end
local number = leaderstats.Money
number.Changed:connect(function()
number.Value = Convert(number.Value)
end)

1 comment
Even if something is underlined in blue, that doesn't mean it won't work. There are many situations when a warning will show that are invalid.