KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 10 May 2015 10:03 AM |
I'm getting that error in this script, not sure why because I have 'break' inside the for loop:
for i = 1,30 do clicking.Value.Changed:connect(function() if clicking.Value==2 then break --? end end) reclaim.Value = reclaim.Value+1 bar.Size = UDim2.new((i*.3333333333333333333334)/10,-8,1,-8) wait(1) end |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 10 May 2015 10:03 AM |
| Woah, the website screwed that layout up |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 10 May 2015 10:04 AM |
| Just use "return true", it basicly does the same. |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
| |
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 10 May 2015 10:09 AM |
Doesn't seem to work, it will print 'd' when the value is changed, but the loop will continue and not print 'done' until it's done looping:
for i = 1,30 do clicking.Changed:connect(function() if clicking.Value==2 then print("d") return true end end) reclaim.Value = reclaim.Value+1 bar.Size = UDim2.new((i*.3333333333333333333334)/10,-8,1,-8) wait(1) end print("done") |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
| |
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
| |
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
| |
|
ganger800
|
  |
| Joined: 06 Dec 2012 |
| Total Posts: 427 |
|
|
| 10 May 2015 10:40 AM |
The program will do the fellowing: - connect 30 times clicking.Changed - you press something, which will fire the print("d")
however the connected function has no effect to the loop (I think something with scoop) that is why the loop continues (and break/return has not the effect you want)
solution: declare a variable before the loop and check it every loop only 1 time connect the .Changed and change the variable when fired |
|
|
| Report Abuse |
|
|
KLGA
|
  |
| Joined: 19 Apr 2014 |
| Total Posts: 2571 |
|
|
| 10 May 2015 10:41 AM |
| Alright, I'll give this a try, thanks ganger. |
|
|
| Report Abuse |
|
|