Hi, I am working on some abbreviated money for a game I'm working on. The only problem is once you reach a certain number I reach some problems.

I will post what is returned below

K - 1.0K M - 1.0M B - 1.0B T - 1.0T T(10) - 10.0T T(100) - 1e.+K+ (That problems continues until quintillions...) When I reach "9223372036854775807" that is the Number Limit roblox has in place I am assuming and if it ticks over it will go into ? -9223372036854775807. Which is also a problem.

If anyone has any ideas on how to fix this please comment below. (:

	while wait() do
		local x = tostring(EarthCash.Value)
		if #x >= 43 then --Td
			EarthCashAbbreviated.Value = x:sub(0, (#x-42)).."."..(x:sub(#x-41, (#x-41))).."Td+"
		elseif #x >= 40 then--Dd
			EarthCashAbbreviated.Value = x:sub(0, (#x-39)).."."..(x:sub(#x-38, (#x-38))).."Dd+"
		elseif #x >= 37 then--Ud
			EarthCashAbbreviated.Value = x:sub(0, (#x-36)).."."..(x:sub(#x-35, (#x-35))).."Sx+"				
		elseif #x >= 34 then--De
			EarthCashAbbreviated.Value = x:sub(0, (#x-33)).."."..(x:sub(#x-32, (#x-32))).."Sp+"
		elseif #x >= 31 then--No
			EarthCashAbbreviated.Value = x:sub(0, (#x-30)).."."..(x:sub(#x-29, (#x-29))).."Sp+"
		elseif #x >= 28 then--Oc
			EarthCashAbbreviated.Value = x:sub(0, (#x-27)).."."..(x:sub(#x-26, (#x-26))).."Sx+"				
		elseif #x >= 25 then--Sp
			EarthCashAbbreviated.Value = x:sub(0, (#x-24)).."."..(x:sub(#x-23, (#x-23))).."Sp+"
		elseif #x >= 22 then--Sx
			EarthCashAbbreviated.Value = x:sub(0, (#x-21)).."."..(x:sub(#x-20, (#x-20))).."Sx+"	
		elseif #x >= 19 then--Qi
			EarthCashAbbreviated.Value = x:sub(0, (#x-18)).."."..(x:sub(#x-17, (#x-17))).."Qi+"
		elseif #x >= 16 then--Qu
			EarthCashAbbreviated.Value = x:sub(0, (#x-15)).."."..(x:sub(#x-14, (#x-14))).."Qu+"			
		elseif #x >= 13 then--T
			EarthCashAbbreviated.Value = x:sub(0, (#x-12)).."."..(x:sub(#x-11, (#x-11))).."T+"
		elseif #x >= 10 then--B
			EarthCashAbbreviated.Value = x:sub(0, (#x-9)).."."..(x:sub(#x-8, (#x-8))).."B+"	
		elseif #x >= 7 then--M
			EarthCashAbbreviated.Value = x:sub(0, (#x-6)).."."..(x:sub(#x-5, (#x-5))).."M+"
		elseif #x >= 4 then--K
			EarthCashAbbreviated.Value = x:sub(0, (#x-3)).."."..(x:sub(#x-2, (#x-2))).."K+"	
		else
			EarthCashAbbreviated.Value = tostring(EarthCash.Value)
		end
	end

4 comments

0

Change the value type to int value ? hmm that could work

0

@Nguyenlegiahung Since I need to display strings changing it to an int value wont help. I tried changing it to a string but it still broke.

0

@Azarth again, my problem is that the number won't go over 9,223,372,036,854,775,807. Which I have now discovered is the maximum limit for an integer.