I am trying to make a script to go up to like Quadrillion, and Quintilian but it messes up at 100 Trillion, can anyone help me with this?
Code:
local money = script.Parent.Parent["Money"] while wait() do local val = math.abs(money.Value) local str = tostring(val) -- Trillions if val >=1e+14 then script.Parent.Text = string.sub(str, 1,3).."."..string.sub(str, 4,4).."T+" elseif val >=1e+13 then script.Parent.Text = string.sub(str, 1,2).."."..string.sub(str, 3,3).."T+" elseif val >=1e+12 then script.Parent.Text = string.sub(str, 1,1).."."..string.sub(str, 2,2).."T+" -- Billions elseif val >=1e+11 then script.Parent.Text = string.sub(str, 1,3).."."..string.sub(str, 3,3).."B+" elseif val >=1e+10 then script.Parent.Text = string.sub(str, 1,2).."."..string.sub(str, 3,3).."B+" elseif val >=1e+9 then script.Parent.Text = string.sub(str, 1,1).."."..string.sub(str, 2,2).."B+" -- Millions elseif val >=1e+8 then script.Parent.Text = string.sub(str, 1,3).."."..string.sub(str, 3,3).."M+" elseif val >=1e+7 then script.Parent.Text = string.sub(str, 1,2).."."..string.sub(str, 3,3).."M+" elseif val >=1e+6 then script.Parent.Text = string.sub(str, 1,1).."."..string.sub(str, 2,2).."M+" -- Thousands elseif val >=1e+5 then script.Parent.Text = string.sub(str, 1,3).."."..string.sub(str, 3,3).."M+" elseif val >=1e+4 then script.Parent.Text = string.sub(str, 1,2).."."..string.sub(str, 3,3).."M+" elseif val >=1e+3 then script.Parent.Text = string.sub(str, 1,1).."."..string.sub(str, 2,2).."M+" -- Hundreds elseif val >=0 then script.Parent.Text = str end end
ROBLOX uses a 32-bit platform which means ROBLOX Lua cannot hold numbers larger than 4,294,967,295. You are experiencing an integer overflow and there's no way around it as far as I know. Here is the Wikipedia entry if you want to understand what an Integer Overflow is https://en.wikipedia.org/wiki/Integer_overflow . Why do you even need that much money anyway?