for RemoteFunctions, the function just by itself should be the variable, and then you bind the function to the RemoteFunction later.
local function TriggeredFunc(message)
print(message)
end
Event.OnServerInvoke = TriggeredFunc
The Event.OnServerInvoke isn’t a connection really, it’s more rigid and kind of its own variable in and of itself, needing an equals sign to be set up for receiving input, which is why it can’t really be stored in memory.
I’d like to add (to further follow your code-structure) that this can also be done as below, without having to deliberately initiate a separate function to later assign to the connections table.
connections['EventTriggered'] = function(Player:Player,A,B,C,D,E,F,G,H,I,J)
-- Code
end
Event.OnServerInvoke = connections['EventTriggered']
Lastly, when assigning the Invoke callback Event.OnServerInvoke = functionName(no, parametersNeeded, here), you do not need to parse the function’s parameters alongwith it as the function call is all that’s needed, and the rest is automatically parsed as the function call proceeds.
Anyways, it’s a property and does not return anything else as it’s not a ScriptConnection! You don’t need to store it as there is no disconnection either. Treat Event.OnServerInvoke as a property, not a method. If you ever want to “disconnect” it, just set Event.OnServerInvoke to nil.