Hello everyone! I hope you are feeling well! Recently I have come across this issue. Coroutines are glitching the remote function, test it yourself. I don’t have access to report a bug sadly. Basically, if you call the Glitch function like this in client, the RemoteFunction will glitch:
local RemoteFunction = game.ReplicatedStorage.RemoteFunction
local Threads = {}
local RunService = game:GetService("RunService")
RunService.Stepped:Connect(function()
for i, v in next, Threads do
Threads[i] = nil
coroutine.resume(i)
end
end)
local function Glitch()
local Thread = coroutine.running()
Threads[Thread] = true
return coroutine.yield()
end
RemoteFunction.OnClientInvoke = function()
Glitch()
print("I have finished, but the server is sleeping still!")
end
Is this a real glitch? The server hangs forever for some reason.
This seems to be on the client. The client can not return anything to the server(take a look at the RemoteFunction examples). Please also keep in mind that you are also running coroutine.yield(you seem to be resuming it, but I don’t have much knowledge on coroutine). I am also confused about what the exact glitch seems to be.
RemoteFunction exmaples
Client to Server Example:
Client(s) fire RemoteFunction
Server receives the request
Server returns data
Server to Client Example:
Server fires RemoteFunction
Client Receives RemoteFunction
The client cannot/will not return anything (Your best using RemoteEvents as its safer)
The client can return stuff to the server if you use the InvokeClient method. The thing is I have a custom wait which uses coroutines. The client returns but the server stills waits for no reason even though the client finished.
Good eye my dude. You are correct. This issue is brought up several times in bug reports, and as of 24 days ago a staff member has added it to their to-do list. It might be a little hard to trace and with not much incentive, but hopefully they can get something done.
I really am impressed though, you did a really thorough job of pinpointing the exact issue. You’ve definitely got a future in programming should you choose.