Remote event Queue Exhausted: Is a remote listener necessary to be implemented?

In my game, there are few remote events that are frequently sent for things like replication. When a player initially joins and .OnClientEvent has not been set up, the console spams the error. Despite the OnClientEvent is already being ran separately in another script.

I am thinking of implementing a module, which sends a signal to the server ONLY when .OnClientEvent is registered, here’s a basic pseudo overview:

Client:

ModuleScript: OnClientModule

OnClientModule.Register(Remote, func)
     Remote.OnClientEvent:Connect(func)
     NotifyServer:FireServer(Remote)
end

LocalScript: Main

require(OnClientModule).Register(RemoteEvent, function()
     print("Received")
end)

Server:

Script: ServerMain

Listner = {}
NotifyServer.OnServerEvent:Connect(function(plr, Remote)
    Listner[plr] = {}
    Listener[plr][Remote] = true
end)
-- For :FireClient
local RemoteToFire = RemoteEventABC
if Listner[plr] and Listner[plr][RemoteToFire] then
    RemoteToFire:FireClient(plr)
end

-- For :FireAllClients
for i,v in pairs (Listener) do
    if v[RemoteToFire] then
        RemoteToFire:FireClient(i)
    end
end

Basically, there’s a module which registers any OnClientEvent. After registering, it will let the server to know that the client is ready to listen the calls.

However, is this necessary?

Upsides:

  • Client is nearly guaranteed to receive the call even when lagging.
    (Will have to add yield function to the remote, if the client is not ready and the remote has “yield” on, it will wait until the client is ready (things like Data need to be guaranteed transformed), else if the client is not ready and this remote doesn’t yield, just simply drop the request.)
  • No more “exhausted” error spams

Downsides:

  • A centralized module for firing remotes, to check whether a player is an active listener, remotes can no longer freely use :FireClient() on it’s own
  • Performance wise(?)

My current solution, either:

  • Fully implement this method for the sake of integrity.
  • Only implement this method on remotes that are frequently used (like the one in the screenshot above), but the problem is how is “frequent remotes” being defined? All remotes have the chance of being dropped!

I want to know is there any game or framework out there is using any similar methods, is it worth it to change up my code to do this? Thoughts?

1 Like

Use wait(0) in the server script loop.