How does simulator games to operate with really big numbers?

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 :heart:

1 Like

You have to use a BigNum library. This will handle the conversion between strings and number values for you, along with the math.

2 Likes

Is there any tutorial? I really don’t get how it works

There is documentation here: BigNum - RoStrap

1 Like

This has been asked before. Please use the search bar before posting topics to this category.

1 Like

Hi, thanks for your comment! Yes, I reviewed each post, each comment, here and on other pages. But I had to invent my own way of solving this

1 Like

Could you tell me how you managed to do this?

You can use the BigNum interpretation for roblox. Look up roblox big num

1 Like

You simply can’t since roblox deprecated Resources:LoadLibrary()
And in the source code the library uses io which is also disabled