.OnServerInvoke only Connecting some of the time

I don’t know why some runtimes this works and sometimes it doesn’t, but I have a function attached to an .OnServerInvoke event and it’s either not firing or not getting connected. It’s possible for me to invoke the function multiple times from the client side during a single runtime so I know if it doesn’t work once it won’t work at all. However, sometimes it does work if I exit the server and restart. Anybody have any clue to why this could be happening?

How are you connecting the event, can we see a sample of the code you’re using.

Server Side

if isServer then
   ObjectEvents.ExecuteOnServer.OnServerInvoke = function(_player, func, ...)
       return ObjectService[func](...)
    end
end

Client Side

return ObjectEvents.ExecuteOnServer:InvokeServer("CreateNew", name, LocalPlayer)

These blocks of code occur in the same script. The script gets initialized on both the server and the client. I have also used this same structure in other scripts without a problem.

Check network traffic. Maybe there are many remotes firing. Also check where a remote is firing, you can switch to unreliable one

Is there a way to view remotes currently in traffic?

I’m not sure, however you can just print whenever a remote is fired to see how often is running

I figured out that Rojo had duplicated my Events folder and so that’s why it was only connecting some of the time is because there was a duplicate event with the exact same path. So, nothing wrong with my code just deleted the other folder and now it’s working. Thanks for your help!

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