Last I heard, most of the functionality that coroutine provides has been superseded by an ultimately better method called task. You can check out its documentation here. As per your error, coroutine.yield returns a tuple, i’d assume true meaning the fact that it returned with no errors(?) I could be wrong.
I believe the issue is that the RemoteFunction invocation is crashing somewhere but being caught by pcall.
Because the code crashes before reaching coroutine.yield, it is never yielding, but because pcall still allows the block as a whole to correctly execute, there is no error written into the output, and coroutine.resume simply returns “true” once it reaches the end of its instructions.
…Although that doesn’t quite make sense, since the block shouldn’t escape until it succeeds. Let me dig a bit deeper.
The issue is a combination of what I mentioned above plus the inclusion of wait following the for loop block. After the pcall captures whatever is causing the problem, the wait calls coroutine.yield internally with no argument, which is what is being returned to your coroutine.resume call.
What you said made a lot of sense when I first read it but… why does this also not print true,“test”
pcall works fine btw I tried printing “err”, it is nil. and when I print “result” it prints the expected result
After setting up a test more similar to yours than my current one, I think the issue is actually the RemoteFunction call, which is unfortunate.
Since RemoteFunction invocations yield until they receive a response from their target, it seems like that’s interrupting the call, even though the invocation is practically instantaneous in studio.