This issue has been plaguing my game as of recent and we’ve tried different signal implementations like LemonSignal we initially thought that it was a ROBLOX update as things were doing just fine before.
To explain my issue whenever I run :Connect() on a GoodSignal and yield for x amount of seconds the thread gets garbage collected which results in unintended behavior with doors, elevators, etc.
Our game has aged quite a bit as it was made in 2022 by someone who was not as experienced at programming. I’ve been working at this game as of January 2024 as a Lead Programmer with my colleague remarkablebeauty.
Here’s a snippet of our server code where the issue is present
Okay so I assigned the task.delay thread to a variable inside the script and when it doesn’t run I check the variable to see what happened using coroutine.status and it returns suspended even though it’s way past it’s delay time. Is there any fix for this?
When you say the thread is getting garbage collection, do you mean it is going into the "dead"?
Spawned threads should resume through the task scheduler regardless on their parent thread’s state, so either something is yielding or killing the callback before it can spawn the thread.
If you believe GoodSignal is the culprit, then try replacing it with a naive implementation that doesn’t do thread reuse (stravant made this one).
Yes this is the case. I will try using SimpleSignal to see if it rectifies any of the problems I am facing. The thread is being killed for whatever reason and it’s causing the task.delay to forever remain suspended and the same thing happens with task.wait and task.spawn doesn’t fix the issue either.