Help with Number "Counting Up" Animation Script

Hello Everyone.

I am trying to make a number “Counting Up” animation script/module but it has some glitching probems when you add numbers while its adding numbers.

I have a better example as a video below (I am very bad at explaining things)

Video Link

If someone can tell me what the problem is that would be nice

OriginalCode
local Tween = function(guiObj, oldValue, newValue) -- label, old value, newvalue
	local num = string.len(newValue)-(0) -- number lenght
	for count = oldValue, newValue, num do wait() -- count = oldvalue, aim/current ammount = Newvalue, duration = num
		guiObj.Text = count -- label text = count 
	end
end

Credits to whoever made this script as it is not mine. I just made some edits to it.

sorry for bad Video Quality

Make it go faster or make a cooldown system which only lets the prompt activate whenever the ‘cooldown’ is over (which means all the coins have been added)

Okay I’ll try that once I get onto my pc again. Should I use a repeat wait or something?

Also if ur the YouTuber then I watch it content. Its really good and helpful