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

Making a Number go up to give a illusion?

I have a question to ask if what im asking is possible. Im recreating cookie clicker. in it, it gives the illusion that you are earning tons of cookies instead of the cookies counter going up every second. is that possible to make that in roblox?

Example of what im trying to say. if you launch the cookie clicker game on the browser. and you get 2x click, which makes it so you can get 2 cookies when u click. it doesn't instantly update to 2, it quickly but slowly enough to go from 1, to 2, its a neat illusion and i want it to be in this one aswell. Of course when you're at like 100, its quickly enough that it can go up to 100 in a second.

1 comment

0

Wait, doesn't it just update the number? Can you show what you are talking about.

1 answer

use a for loop:

function updateNumber(finalNumber)
	local waitTime = 1/finalNumber -- figure out how long we have to wait per number to make sure the value gets changed to final number every second
	for i = 1, finalNumber do
		--TODO: change the numCookies text box to be the number 'i'
		wait(waitTime)
	end
end

updateNumber(100)


as Overscores said, the minimum wait() can be 1/30th of a second so any number smaller than that will be longer than a second.

2 comments

0

Best explain ever. Upvoted.

0

Usually, wait() only functions at 30 per second, so any number above 30 won't finish in one second.

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