So lets say I have:
for i = 1,100 do local x = coroutine.create(function() print("Alright") end) coroutine.resume(x) end
Once the coroutine is made and has run, do I have to remove it to prevent script lag? I think of it as creating 100 functions only to be used once, and once run are just a waste of space. But I think I'm wrong; can someone clear this up for me? Thanks!
No - the thread scheduler and garbage collector should do all the clean-up for you. In any case, there isn't really a way to "remove" coroutines in that sense -- it will just reach the dead state and no longer be affecting your game in any way.
You can prove this to yourself by opening studio and enabling "Script Performance" in the VIEW tab. Put this Script into workspace:
for i = 1, 500 do coroutine.resume(coroutine.create(function() wait(1); warn(i); end)) wait(); end
and play test the game. Check out the row for the Script in the Script Performance window -- it will get up to about 18 threads/second with 0.1% activity while running, but once its done it will read 0's across the board.