Sharksie
(Sharksie)
February 3, 2022, 5:16am
#1
Reproduction Steps
Script
require(module)
print('resumed')
Module
local thread = coroutine.running()
task.defer(coroutine.resume, thread)
coroutine.yield()
print('finished')
return 1
Expected Behavior
output finished
and then resumed
The Script
thread should resume, resolving the require
as 1
after once Module
finishes running
Actual Behavior
output only finished
not resumed
The Script
thread does not resume after Module
finishes
Issue Area: Engine
Issue Type: Other
Impact: High
Frequency: Constantly
Note: This appears to only happen if you work with the coroutine directly. BindableEvents, for example, can yield and resume without issue.
3 Likes
focasds
(focasds)
February 3, 2022, 4:03pm
#2
Yes, this issue occurs as well if you do the same for callbacks like RemoteFunctions, BindableFunction, between other things I probably don’t know.
task.spawn should be used for resuming coroutines now. They gotta fix the issue with coroutine.resume though as well as fixing how Instances behave in weak tables.
By the way here is a very old post of mine, the code is different, but it literally does the same: Glitch with RemoteFunctions? - Help and Feedback / Scripting Support - DevForum | Roblox
1 Like
Sharksie
(Sharksie)
February 3, 2022, 7:30pm
#3
It does appear that coroutine.resume is the broken component of this interaction
This is probably due to the modulescript code returning while not under the control of the Roblox task scheduler.
Does task.defer(coroutine.running())
work?