If you could, that'd be great! (I want to know to further my knowledge and in the end help more people here. If anyone knows how to explain it, please do!)
A coroutine is essentially a new thread within a script. This allows you to have multiple loops at the same time and to continue a script while also yielding, amongst other things. For example:
01 | local loop = coroutine.create( function () |
02 | while true do |
03 | wait() |
04 | print ( "Hello" ) |
05 | end |
06 | end ) |
07 | coroutine.resume(loop) |
08 | while wait() do |
09 | print ( "World!" ) |
10 | end |
11 | --Both loops here would run simultaneously |