Add get for RemoteFunction.OnServerInvoke / OnClientInvoke

As a Roblox developer, it is currently impractical to add shims and middleware to RemoteFunctions due to not being able to get the value of OnServerInvoke / OnClientInvoke.

If Roblox is able to address this issue, it would improve my development experience because I can build generic tools for RemoteFunctions.

Coming from a web developer perspective this would enable generic building tools such as:

  • Network performance debugging tools (see proof of concept below)
  • Remote call throttles and mutexes
  • Other types of generic middleware (validation, auth etc)

Example how I see it would be used:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

print("Initializing call stats")

local function hookRemoteFunction(remoteFunction)
	local originalInvoke = remoteFunction.OnServerInvoke -- This will throw error
	remoteFunction.OnServerInvoke = function(...)
		print("TODO: increment counter for RemoteFunction:", remoteFunction.Name)
		return originalInvoke(...)

for _, desc in pairs(ReplicatedStorage:GetDescendants()) do
	if desc:IsA("RemoteFunction") then

	if desc:IsA("RemoteFunction") then

Current workaround:

Call the “middleware” function in the beginning of each invoke handler and/or assign the SetInvoke using a custom setup function that hooks the middleware before calling the actual handler.

Downside with the workaround is that the if you build a reusable middleware it will need manual code changes for each RemoteFunction used in the project.

Some reflections on this:

The workaround(s) might not be a huge effort to do as a developer, but on the other hand I cannot see any reason why get calls to OnServerInvoke / OnClientInvoke are not allowed.

Related References:


Being able to listen to RemoteFunctions and BindableFunctions would majorly improve my ability to create effective anti-exploit tools that listen for remote abuse, and also make it possible to create more modular remote libraries that don’t require extensive setup. Please implement this! :slightly_smiling_face: