So, I've been working on this ATM, and I want this money to go up or down by +1 every time you lose or gain money

So, it cycles through, 1-2-3-4-5-6-7-8-9-10 instead of just changing.

But I've gone through my list of ideas of how to fix, figured you guys may have a better explanation.

Update: I got it to update correctly, but it won't cycle, so if I gained $10, it updates, but it won't go 1-2-3-4-5-6-7-8-9-10 up until the current value.

And I want it to go faster as the money is greater as well.

AnimateMoney = function(text)
	local current = tonumber(text)
	local money = Money.Value
	local index,index2
	
	for idx = 10,3,-1 do
		
		print(idx)
		if money > 1 then
			index = idx
			index2 = idx-1
			break
		end
	end
	
	for i = current,money do
		if index then
			if i*index == 0 then wait() end
			Pocket.Text = ConvertLongNum(i)
		end
		--if money%index2 == 0 then wait() end
		if index2 then
		if i^index2 == 0 then wait() end
		Pocket.Text = ConvertLongNum(i)
		end
	end
end

MoneyChanged = true
Money.Changed:connect(function()
	
	AnimateMoney(Player.Pocket.Value)

Do NOT worry about the "ConvertLongNum" it's simply in the module I have set, and works flawlessly.