coroutine.yield does not seem to stop a coroutine with a while loop inside. For example:
local spam = coroutine.create(function()
while true do
print("oof")
wait(1)
end
end)
coroutine.resume(spam)
wait(3) --Should print "oof" 3 times
coroutine.yield()
Yet the coroutine will continue to print "oof" indefinitely. Does anybody know of a fix for this?

2 comments
At line 6 you forgot an end)
Once coroutine.resume is called upon, the loop is started, and can only be stopped with break, so wait(3) will not run.