i never heard of coroutine and im just curios what it does, maybe it can help in the future
What is "coroutine" for and what is it useful for?
1 answer
coroutine is used to run scripts at the same time (similar to creating a new script in workspace). if you had to run 2 functions at the same time, you could use them for example
coroutine.resume(coroutine.create(function()
print("Hi")
end))
print("Hi")
They would print both at the same second.
There are more ways to use them, but this is a first way to know their job.
coroutine.create() makes a coroutine, in which you can place code.
coroutine.resume() runs the coroutine, like if you run a normal script by playing the game or pressing a button.
coroutine.wrap() acts like both above
coroutine.yield() yields (pauses/stops) the script
There are more uses for it and more corutine commands, if you want to know more go here: Beginners Guide to Coroutine
This discussion is preserved as it was. New answers, comments, and votes are closed.
