Hello! I hope you are feeling well today! I have noticed that __mode is not behaving as expected. I don’t know what’s going with it.
Anyways when you use any sort of yield, and the yield last for more than 5 seconds it will glitch __mode behavior. Is this expected?
I was having a similar issue with this a few days ago. When I went into a live game, it functioned normally. In Studio, the problem only occurred on the server. (But if the delay was small enough, it also worked normally.)
I was just dealing with this problem today. Here’s my interpretation: in order for an object with a weak reference to be garbage collected, the garbage collector must run in the first place. If there aren’t any scripts actively doing anything, and memory usage is good, then there’s no reason for the garbage collector to run. This is likely what is happening.
I’ve found that adding the following line somewhere will keep things active and cause the garbage collector to run more often:
Doesn’t Roblox disable all collectgarbage arguments except count anyway? I do believe there’s also gcinfo() as a shorthand for collectgarbage(“count”).
Unfortunately, collectgarbage hasn’t allowed any argument except “count” for over a decade, and neither “count” nor gcinfo actually causes the GC to run, either.