Is there a possible way to pause a running coroutine/thread/function?

I’m trying to get an idea from Adonis’s task manager. However, I just don’t simply have an idea of how to stop or pause a running thread. Any ideas of this being possible?

coroutine.yield pauses a coroutine, and you can also return information with coroutine.yield. You could look up more here.

1 Like

I tried doing it like this to a coroutine function:

local corot = coroutine.create(function()
 while wait() do
   print"Test"
 end
end) 

coroutine.resume(corot)
wait(10)
coroutine.yield(corot)

After 10 seconds, it still won’t stop. I want to be able to pause the coroutine without yielding it in the inside.

2 Likes

I don’t think that’s possible yet until Roblox adds some more coroutine functions. You could look at this other post someone made a few weeks ago.