Skip to content

Commit

Permalink
Fix signal:Wait() method when :Fire() is called after :Wait() in a no…
Browse files Browse the repository at this point in the history
…n-suspended coroutine. (#223)

Fixes the error "cannot spawn non-suspended coroutine with arguments", as seen in https://www.youtube.com/watch?v=yevAvHU3ewo

The coroutine's status is now checked before spawning it in :Wait().
  • Loading branch information
wclxb authored Jan 21, 2025
1 parent 7c7a5ea commit c520948
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/signal/init.luau
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,10 @@ function Signal:Wait()

self:Once(function(...)
yieldedThreads[thread] = nil
task.spawn(thread, ...)

if coroutine.status(thread) == "suspended" then
task.spawn(thread, ...)
end
end)

return coroutine.yield()
Expand Down

0 comments on commit c520948

Please sign in to comment.