For some reason, coroutine.yield does not a running loop in a coroutine.
Here’s a basic proxy of my code:
local routine = coroutine.create(function()
while true do
print("Running..")
wait(1)
end
end)
coroutine.resume(routine)
wait(3) -- should print 3 times
coroutine.yield(routine)
After coroutine.yield has been called, it continues to print.
This is confusing behavior - anyone know any solutions?
Do I need to make my own ‘enabler’ bool variable? I don’t really want to, for performance reasons.
Not an expert on this subject, but I’m pretty sure it’s something like wait() internally calls yield and also adds the thread to the internal Roblox thread scheduler while regular yield does not. This would cause the thread to be automatically resumed by the thread scheduler.