im making a clicking simulator and when ever the player hits 999QN and they get +1QN it shows 1000QN and then if they get even 1 more it force deletes their save data and put it at 0 … it appears to roblox based as i have tried everything and nothing i do seems to fix this…
ik it has a fix as games with 1QNSXDOUNDETREQUSECTREUNDE as a currency exist
If you’re using IntValues, switch to NumberValues. Ints have a much lower limit than floats (NumberValue using floats).
If you’re trying to go above 10^308/1e+308 (float limit) then I recommend InfiniteMath, but I’m guessing for your case you won’t need it.
You could also check for math.clamp, you might be clamping the numbers so they can’t go above a certain number. It might also be an issue with your games calculations in specific, you should look through your math and double check.
Seems like your suffix function is messing with something, try replacing it with this (you can edit the Suffixes table to use ones you prefer)
local Suffixes = {'K','M','B','T','QD','QN','S','SP','O','N','D'}
local function Suffix(Number)
if Number == 0 then
return "0"
end
local Sign = math.sign(Number)
Number = math.abs(Number)
local Zeros = math.floor(math.log(Number, 1e3))
local v = math.pow(10, Zeros * 3)
return ("%.3f"):format((Number / v) * Sign):gsub("%.?0+$", "") .. (Suffixes[Zeros] or "")
end
Could you send the code where you’re getting the errors? All you should need to do is Suffix(Number) and it will return a string of the number formatted
It’d really help to have the errors as well, without them I don’t know what’s going wrong. You can just only blur your notes if they need to be private.
local Number = 1000000
local Formatted = Suffix(Number) -- you can't do math with this, its a string now
print(Number) -- prints "1M"
Overflow Handling: The issue you’re experiencing might be related to an overflow error. When the currency value exceeds a certain limit, it can cause unexpected behavior. Ensure that you are using data types that can handle large numbers, such as BigNum or BigInt, to prevent overflow issues.
Save Data Handling: Check your save data system to ensure that it properly handles large currency values. Verify that the save data is correctly storing and retrieving the currency value without any loss or corruption.
Data Validation: Review your code that checks for the currency value and triggers the reset. Make sure that it accurately detects the conditions for the reset and doesn’t have any unintended side effects or logic errors. Double-check the comparison operators and conditions used in the code.
Testing and Debugging: Conduct thorough testing to pinpoint the exact point where the issue occurs. Use print statements or logging to track the currency value and identify any unexpected behavior or errors that may occur during the process. This will help you narrow down the problem and identify potential solutions.
Please also consider localisation. A billion is either 10**9 or 10**12, depending on where you’re from. I don’t want to see the world any more angloformed than it already is.
That’s why I recommend SI prefixes.
When is the last time I’ve heard of a 512 BB drive?