Hi, I’m making my very first game on Roblox, a simulator game and I reached to the point of operating, store, and show numbers like 450.200Qa… 735.000s… How can I store that huge amount of digits in a IntValue or NumberValue? the numbers are changed to like “1e+30”… Or should I use a StringValue and tostring and tonumber every time that I want to do something?
I’ve tryed to do something with that “1e+30” number and I get to this:
local number = script.Parent.Number.Value (1000000000000000000000000000000) but its 1.0000000000000000199e+30
local s = string.format(“%f”,number)
s = s:sub(1,s:find(“%.”) - 1)
and I reached to this number = 1000000000000000019884624838656
It’s unprecise at the end but I don’t care about that last numbers. After this I have to abbreviate it with the following code to get to 100.000s for example
local text = tostring(math.floor(s))
local chosenAb
for abbrevietion, digits in pairs(abbreviations) do
if #text >= digits and #text < (digits + 3) then
chosenAb = abbrevietion
break
end
end
if chosenAb then
local digits = abbreviations[chosenAb]
local rounded = math.floor(number / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
text = string.format("%.2f", rounded / 10 ^ (digits - 1)) .. chosenAb
else
text = number
end
But this works only with numbers smaller than 10.000.000.000.000 or so…
After a investigation I found the BigNum Library of RoStrap but I get really confused about how to work with it… So my question is what I have to use? Int, Strings, BigNum ? Thank you