|
| 31 May 2017 01:54 PM |
| How can I create a loop within a function that I can later stop. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 31 May 2017 02:07 PM |
Internally = break/change variable Externally = change variable/coroutine but you probably don't need to
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 02:29 PM |
while wait() do --do stuff if something then break -- break ends the loop end end
|
|
|
| Report Abuse |
|
|
AxonMega
|
  |
| Joined: 29 Aug 2014 |
| Total Posts: 2403 |
|
| |
|
|
| 31 May 2017 02:30 PM |
@bigboy77584
Or...
while something do -- do stuff end
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 02:32 PM |
"coroutine.yield"
Read the OP again.
|
|
|
| Report Abuse |
|
|
|
| 31 May 2017 02:40 PM |
local run = true
spawn(function() while (run) do print("running") wait(1) end end)
wait(10) run = false |
|
|
| Report Abuse |
|
|