|
| 30 Nov 2012 05:18 PM |
What it does? It's a spree script, the person gets a point, and the count-down time resets to 20, but my problem is the break doesn't work because I cant think of a system that would get the loop to restart if player gets more points.
script.Parent.Parent.CurrentPoints.Changed:connect(function() ready = false time = 20 ready = true for i = time, 1 ,-1 do if ready == false then break end wait(1) time = time -1 print(time) if time == 1 then script.Parent.Parent.CurrentPoints.Value = 0 end end
end) |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:26 PM |
| Use the term "break" in the script where you want it to break |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:27 PM |
| Please look at what I've done. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:32 PM |
| This really makes no sense, as the functions fires when the value is changed, and you are changing it within your loop. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:34 PM |
| So you are trying to make the script break when the spree has ended I am assuming. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:35 PM |
| You could use a while loop. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:37 PM |
Argh nope. :/
There is a time limit, a person scores a point and the time limit sets off, if it reaches 0, the spree points returns to 0, but if they score another point during the count down, the count down restarts back at 20.
I know this is confusing, it's basically like stacking points. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:38 PM |
I have done:
script.Parent.Parent.CurrentPoints.Changed:connect(function() ready = false time = 20 wait() ready = true
while ready == true do if ready == false then break end wait(1) time = time -1 print(time) if time == 0 then script.Parent.Parent.CurrentPoints.Value = 0 --reset the spree :) DIE! lolol! break else end end
end)
problem is that it has the same effect as the for loop, it will continue to count down in 2s showing that the loop never stoped when the time restarted, |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:42 PM |
| Never mind, the wait just needed to be longer. |
|
|
| Report Abuse |
|
|
|
| 30 Nov 2012 05:43 PM |
ready = false time = 20 wait() ready = true
I don't quite understand the purpose of that. |
|
|
| Report Abuse |
|
|
| |
|