I want to resume and stop coroutines with loops, but I ran into some issues.
coroutine.yield does not stop thread execution, rather script execution.
I tried looking on both the dev hub and devforum, but couldn’t find anything.
local c
c = coroutine.create(function()
while wait(0.5) do
print(coroutine.status(c))
if coroutine.status(c) == "suspended" then
print("sus")
break
end
end
end)
coroutine.resume(c)
wait(3)
coroutine.yield(c)
--wait(3)
--coroutine.resume(c)
I yield the coroutine, but it never gets the ‘suspended’ state and is always running