Suddenly I started getting the error: "Remote event invocation queue exhausted" (SOMETIMES)

Reproduction Steps

I don’t know how you can reproduce it, because nothing was changed in my script and suddenly I started getting this error.

I first noticed this error on Roblox Player.
Afterwards, I tested it in Studio and the error also occurred.
The strangest thing is that SOMETIMES the error does not occur and the project works.
This means there is some INTERMITTENT ERROR ON ROBLOX SERVERS SIDE.

Expected Behavior

No errors.

Actual Behavior

I have a unique RemoteEvent object:
ZmTcWxiDMd

I have the OnClientEvent on LocalScript:

RemoteEvent.OnClientEvent:Connect(function(FunctionName, ...)
	Function[FunctionName](...)
end)

Issue Area: Engine
Issue Type: Freezing
Impact: Very High
Frequency: Constantly
Date First Experienced: 2022-12-07 18:12:00 (-03:00)

1 Like

The error occurs when you send a lot of FireAllClients or FireClient, so, do you have any loop or function with that?

This is not a bug, it’s a feature of Roblox that is designed to reduce the spamming of remote events. It is strange however because exploiters have managed to bypass this somehow in one game I used to work in and could mass spam everyone.

How much is “a lot of” exactly?

I don’t have a loop, but as shown in the OP, I have a SINGLE RemoteEvent object for all FireClient.
And it’s called inside a function (in the Server):

function FireClient(Player, FunctionName, ...)
	RemoteEvent:FireClient(Player, FunctionName, ...)
end

Here the part of LocalScript (as shown in OP):

RemoteEvent.OnClientEvent:Connect(function(FunctionName, ...)
	Function[FunctionName](...)
end)

I put a print there to certify each FireClient.
Nothing different from it was always (exactly 29 calls when the game starts).
And as I said before, this error is occurring SOMETIMES when I start the project, which means nothing is wrong in the code.

The remote invocation queue is a convenience feature of the RemoteEvent class. The intent is to allow the event to be fired before anything is connected on the receiving end. eg, you can create a remote event on the server and fire it without an explicit mechanism to ensure the client has connected a function to it.

The error is telling you that a remote event with the name “RemoteEvent” is being fired from the server multiple times, but the client isn’t expecting this. My guess is that either a server script using the wrong “RemoteEvent” due to name collision, or a cent localscript issue that no longer connects a function to the event.

–edit: it sounds like both of these should be covered. this makes me think the client localscript sometimes doesn’t do the connection. It’s also possible to disconnect the function in lua, although I’m guessing that’s not happening.

2 Likes

This is new to me.
I notice that my LocalScript is loading AFTER a few FireClients.
What is the limit of this queue? I don’t see this documented anywhere.

Firing it 29 times for each clients (since you are using FireClient) when the game starts seems like a lot to me. (If there is less than 1 second between the 29 firing)

As for what ConvexHero just said, it might also be because you don’t use :WaitForChild(“name_here”) in one or your localscript / script to wait for the remoteEvent object to load. However, it seems that this is not the case since another error should appear in that case. Try to wait for the client to finish loading the game (the localscript in that case) before firing. This could help the localscript to bind to the remoteEvent before the server side script use FireClient.

2 Likes

On closer inspection, you’re right.
Until today, my script on the server fired some FireClient BEFORE the LocalScript was loaded.
Since this never generated an error, I didn’t pay attention to it. But as said by @ConvexHero, apparently there is an internal queue that prevented this error from being generated, and apparently, when LocalScript finished loading, this queue was unloaded and no error occurred.
I noticed that I have some FireClient that are fired for every object created by the player in my game.
As the game is starting the testing phase, new objects are being created, which has generated more FireClient, and apparently this is what has burst this aforementioned queue.
I’ll fix this.
Thanks.

1 Like

@SOTR654 @LifeDigger @ConvexHero @Med367367

Just to confirm (and leave it documented for anyone going through similar problems in the future):

This error not caused by “too many FireClients” sent, but “too many FireClients sent BEFORE the LocalScript is completely loaded”.

As I said in the previous post, I have several FireClient sent before the LocalScript is loaded.
In order not to change the logic in the server script, I created an array where I accumulate a queue of all the FireClient that are requested before the LocalScript is loaded.
And when the LocalScript is finally loaded, I unload this whole queue, executing each pending FireClient.

And this fixed the errors.

Ah I see, thanks for letting me know. I was confused about how an exploiter managed to mass spam the event in my game without any restriction from roblox so this makes sense.

1 Like

This does indeed seem to be a way to solve the problem, however, be aware that if your “queue” table becomes too long and sends a ton of FireClient over a small amount of time or if there are multiple users with a long queue at the same time, you may be temporarily rate-limited in sending RemoteEvent/Functions on the game/place/experience (a warning should appear in the console).

1 Like

Thanks, but up to now, no one could answer what’s this “magical” limit number…

It exists somewhere, but unfortunately, since Roblox reorganized their documentation, they have either completely removed the link to it or it’s in a whole new / hard to find category. I remember seeing it a long time ago, but even now, using waybackmachine to look at the old Roblox documentation, it doesn’t seem to be mentioned :confused: .

Your best bet is probably to look at old messages like this one, but some of the information may be inaccurate.

https://devforum.roblox.com/t/is-there-a-limit-on-remoteevent-calls/25160/3

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.