I have been trying to make a gui display the leaderstats value and I've already made the module script

local abbreviateNum = {}

local abbreviations = {

	K = 4,
	
	M = 7,
	
	B = 10,
	
	T = 13,
	
	Qa = 16,
	
	Qui = 19,
	
	Sex = 22,
	
	Sept = 25,
	
	Oct = 28,
	
	Non = 31,
	
	Dec = 34,
	
	Un = 37,
	
	Duo = 40,
	
	Tre = 43

}


function abbreviateNum:Abbreviate(number)
	
		local text = tostring(math.floor(number))
	
	print(#text)
	
	local chosenAbbreviation 
	
	for abbreviation, digits in pairs(abbreviations)do
		
		if #text >= digits and #text < (digits + 3) then
			
			chosenAbbreviation = abbreviation
			
			break
		end
	end
	
	if chosenAbbreviation then
		
		local digits = abbreviations[chosenAbbreviation]
		
		print(chosenAbbreviation)
		
		print(digits)
		
		local rounded = math.floor(number / 10 ^ (digits - 2)) * 10 ^ (digits - 2)
		
		text = "Coins: "..string.format("%.1f", rounded / 10 ^ (digits - 1))..chosenAbbreviation
		
	else
		
		text = "Coins: "..number
	end
	
	return text
	
end

return abbreviateNum

All I want to do is for the text in the textlabel to constantly update and get abbreviated at the same time.

2 comments

0

I mean like do you have any ideas for the label to be constantly updating and abbreviating in real time