EDITED
Ok so lets say I have a sequence, like so:
local SequenceIsStopped = false function Sequence() --Do stuff wait(1) --Do stuff wait(1) end
And I wanted to stop the sequence mid-way, how would I go by doing so? The only other way that I know of is putting a conditional that breaks the sequence if SequenceIsStopped = true at the end of every single line. Is there a more effective way? Or is that the only way?
Note: This is what I was talking about when I said that the way I know of is using a conditional:
local SequenceIsStopped = false function Sequence() if SequenceIsStopped then break end --Do stuff if SequenceIsStopped then break end wait(1) if SequenceIsStopped then break end --Do stuff wait(1) end
I know it's terribly inefficient
for i = 1, 5 do print(i) wait(1) if Stop then break end end --The loop should stop if the variable Stop becomes true anywhere in the script.
How about this:
function CheckStopWork() if Stop then return break end end for i = 1, 5 do print(i) wait(1) CheckStopWork() end -- It should break the loop if "Stop" becomes true from somewhere else in the script.
I have no means of testing this, so I hope it works.