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

Changing the Timing on a script?

(Sorry for bad explaining in advance)

So heres the idea , I have a cookie clicker like game because im practicing to script, and when I want my cookies to go up per second, they go up like this ;

(each number is after a second as past in game)

5 10 15 20 25 But I want it to look like this : (so in 1 second it does this) 1 2 3 4 5 and it goes up every number individually , so it looks a bit more exciting , if youve ever played cookie clicker and youll see how the number goes up individually, and not a whole number, thanks :))

2 answers

✓ Accepted answer

You would want to use a while loop for this. I add in the variable "waitTime" in case you want to speed it up or slow it down at a later point. This will give the person 1 every 1/5th of a second, giving them 5 in 1 second.

waitTime = .2
cookies = --locate cookie value object

while wait(waitTime) do
	cookies.Value = cookies.Value + 1
end

If it is going up by 5's, you should just change it from Value + 5 to Value +1, as such:

NumberValue = script.Parent.NumberValue
while true do
	NumberValue.Value + 1 = NumberValue.Value + 1
	wait(1)
end

1 comment

0

In line 3: NumberValue.Value + 1 = NumberValue.Value + 1?

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