During a script, if you have something that you needed to loop in a separate loop to another loop which is currently active, I'd have thought a function would be a good idea, however with normal functions, after being called they continue to take the "scripts time" rather than executing the function simultaneously with the code around it.
For example, as the code below suggests, it has a look, followed by a function with a loop, which the script will execute this function and THEN move onto the next loop. Ideally i'd like the function to continue while the script plays out.
Other than making the function another script, (meaning I want to keep it in the same script without global or anything) is there any other way to go about this?
function WastingTime()
local number=0
for i=1,10 do wait(1)
number=number+1
print("Waiting" .. number)
end
end
wait(1)
for i=1,10 do wait(1)
print("Wait")
end
WastingTime()
for i=1,10 do wait(1)
print("Wait2")
end
-Thank you

1 comment
Interesting, these are very useful. I'm gonna have a quick read up.