I have a problem, I tried to make a K,M,B system, but there is a problem, roblox changes big numbers to numbers like this one --> 1.298018197102000063e+42. But I convert it to a string, so my script sees the number like 1.2 --> wich will result in something like 1K.
This is very annoying, so my question is, is there any way to change them back in a script? (I tried searching for it but I don't know how it's called if there is a name for it).
The script works fine when roblox didn't change the value
(This is my script)
local module = {}
local HighNumbers = {
['K'] = 1000,
['M'] = 1000000,
['B'] = 1000000000,
['T'] = 1000000000000,
['Qd'] = 1000000000000000,
['Qn'] = 1000000000000000000,
['Sx'] = 1000000000000000000000,
['Sp'] = 1000000000000000000000000,
['O'] = 10000000000000000000000000000,
['N'] = 10000000000000000000000000000000,
['D'] = 10000000000000000000000000000000000,
['Ud'] = 1000000000000000000000000000000000000,
['TdD'] = 100000000000000000000000000000000000000,
['QdD'] = 100000000000000000000000000000000000000000,
['QnD'] = 100000000000000000000000000000000000000000000,
['SxD'] = 100000000000000000000000000000000000000000000000,
['SpD'] = 100000000000000000000000000000000000000000000000000,
['SpD'] = 1000000000000000000000000000000000000000000000000000,
['OcD'] = 1000000000000000000000000000000000000000000000000000000,
['NvD'] = 1000000000000000000000000000000000000000000000000000000000,
['VgN'] = 1000000000000000000000000000000000000000000000000000000000000,
['UvG'] = 1000000000000000000000000000000000000000000000000000000000000000,
['DvG'] = 1000000000000000000000000000000000000000000000000000000000000000000,
['TvG'] = 1000000000000000000000000000000000000000000000000000000000000000000000,
['QtV'] = 1000000000000000000000000000000000000000000000000000000000000000000000000,
['QnV'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000,
['SeV'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000,
['SpG'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000,
['OvG'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
['NvG'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
['TgN'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,
['UtG'] = 1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
}
local HighestNum = 10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
local HighestName = 'UtG'
local HC = 999
local Pattern = '%d+'
function module.Convert(Number)
for i,v in pairs(HighNumbers) do
local Rounded = tostring(Number/v):match(Pattern) --> It goes wrong here
--warn('n '..Number..'v '..v..'r '..Rounded)
local RoundedNum = tonumber(Rounded)
warn(Number)
if Number >= v and RoundedNum and RoundedNum < 1000 and Number >= 1000 and Number < HighestNum * HC then
local Result = Rounded..i
warn(Result)
return Result
elseif Number < 1000 then
warn(Number)
return Number
elseif Number > HighestNum * HC then
warn(Number/HighestNum..HighestName)
return Number/HighestNum..HighestName
end
end
end
return module
EDIT: Thanks to MCAndRobloxUnited I found the solution:
Cannot copy the solution, but go take a look at string.format, you can find it there --> Works great
IF ANYONE HAS TROUBLE WITH THIS, YOU CAN EITHER REPLY TO THIS OR SEND ME A MESSAGE TO ME (/MY ROBLOX PROFILE)

2 comments
why go past KMBT tho. scientific notation is properly concise for big numbers.
It's because the game I'm working on purpose is to make as much money as possible, so, is there a way to make it a number again, even if it requeres more string manipulation?