Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this script turn to 1e.+K+ after when it hits 100T? ( Cash Suffix Script )

function module:ConvertShort(Filter_Num)
	local x = tostring(Filter_Num)
	if #x>=13 then
		local important = (#x-12)
		return x:sub(0,(important)).."."..(x:sub(#x-11,(#x-11))).."T+"
	elseif #x>=10 then
		local important = (#x-9)
		return x:sub(0,(important)).."."..(x:sub(#x-7,(#x-7))).."B+"
	elseif #x>= 7 then
		local important = (#x-6)
		return x:sub(0,(important)).."."..(x:sub(#x-5,(#x-5))).."M+"
	elseif #x>=4 then
		return x:sub(0,(#x-3)).."."..(x:sub(#x-2,(#x-2))).."K+"
	else
		return Filter_Num
	end
end

return module

1 answer

because numbers are shown using exponentation (e, not euler) after a set number is passed. you shouldn't use such a brute-force method for something like that, but i'll support it anyway.

you should probably divide by the waypoint (ex. 105 trillion by 100 trillion) in order to get it's base value, then concatenate the quotient with the "T", "K", "B", etc..

or.. you can just find a different way to code it! it's all up to you.

postscript: e is the shorthand for 1x10^n, n being the amount of zeroes.

This discussion is preserved as it was. New answers, comments, and votes are closed.