Formating Money

Good Day,

I am looking for a good Module to format/Shorten Money in-game, such as 1M 1B, 1T etc

Regards
Julian

1 Like

You’re in luck, I made a function for this exact purpose a while ago

local Suffix = {"","K","M","B","T","q","Q","s"}
local function ReadableNumber(num, places)
	places = places or 1
	local Zeros = #tostring(math.floor(num)) - 1
	local Index = math.floor(Zeros/3) + 1
	local Rounded = (math.floor((num/(10^((Index-1)*3)))*10^places)/10^places)

	return Rounded .. Suffix[Index]
end

Hope this helps!

3 Likes