Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Changing the Timing on a script?

Asked by 9 years ago

(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

Log in to vote
2
Answered by 9 years ago

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
Ad
Log in to vote
0
Answered by 9 years ago

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
0
In line 3: NumberValue.Value + 1 = NumberValue.Value + 1? EzraNehemiah_TF2 3552 — 9y

Answer this question