Circular require in new coroutine does not resume when ready

Where
Both in Studio and in live games

Steps to Reproduce
In a blank baseplate, add these scripts to the workspace:

A (ModuleScript)

print("A start")
print("A:", require(workspace.B))
return "A"

B (ModuleScript)

print("B start")
coroutine.resume(coroutine.create(function()
	print("B coroutine start")
	print("B require:", require(workspace.A))
end))
return "B"

C (Script)

print("C start")
print("C:", require(workspace.A))

Actual Output

  C start
  A start
  B start
  B coroutine start
  A: B
  C: A

Expected Behaviour
When ‘B’ is done, this lets ‘A’ finish up, allowing ‘C’ to resume; the brand new coroutine in ‘B’ should also be resumed at this time.

Place with those scripts
require bug.rbxl (18.5 KB)

Workaround
So long as you put it on Roblox’s thread scheduler via wait() or by using spawn/delay instead of using coroutines directly, it works as expected.

1 Like

Thanks for the report! We’ve filed a ticket to our internal database and we’ll follow up here when we have an update for you.

1 Like