Custom Controls Causing Remote Event Exhaustion

Hi all, I’m trying to work out custom controls for my game’s vehicles. I thought I had them working very well but now I’m getting this new error message:

“Remote event invocation queue exhausted for event: did you forget to implement OnServerEvent? (x events dropped)”

I am using remote events with the controls to send an action string to the server to control the vehicle. I’m not sure how I could implement this any other way without opening the controls up for exploits. Any ideas?

You should send regular invokes coming from the server that return any input the player has. This way you can avoid issues with input lagging as the info sent is always the last input. The reason behind the error you are getting is because you are probably sending events every time the player’s input changes in any way, which can be over 100 times a second for analog input such as mice or thumbsticks. Same goes for digital input, though less pronounced.

--server
game:GetService("Players").PlayerAdded:Connect(function(client)
    local playerexists = true
    game:GetService("Players").PlayerRemoving:Connect(function(client1)
        if client == client1 then playerexists = false end --avoid memory leaks
    end)
    while playerexists do
        local input = ControlRemote:InvokeClient(client)
        --handle the input
    end
end)

--client
local input = {} --store input data
ControlRemote.OnClientInvoke = function()
    return input
end
3 Likes

Thank you, I’ll have a go at this and post back with my results.

This seems to be working well so far. It isn’t fully implemented and I haven’t done a full test run but, the controls are feeling responsive enough. I think this will solve the problem, thank you! :smile: :+1:

1 Like