Okay so I'm trying to use a RemoteFunction to return the number of available slots in my custom inventory thingamadoohickey, but it's outputting some sort of weird error that I can't comprehend. Could someone help me with this?
Error: 09:06:21.275 - OnServerInvoke is a callback member of RemoteFunction; you can only set the callback value, get is not available
Error line: script:FindFirstChild("GetSlots").OnServerInvoke:connect(function(player, arg)
Client line: local slots = Workspace.CoreGUIReplace.GetSlots:InvokeServer("Sending slots...")
I'd be very grateful if someone were to help me with this, thanks!
To anybody that stumbles across this, the bug is that OnServerInvoke
is a user-definable function, not an Event.
What this means is that you use it like so:
RemoteFunction.OnServerInvoke = function(params) --code end --Or, alternatively: function RemoteFunction.OnServerInvoke(params) --code end
Instead of like so:
--Remember, this is invalid! RemoteFunction.OnServerInvoke:connect(function(params) --code end) --Or, alternatively: function funcName(params) --code end RemoteFunction.OnServerInvoke:connect(funcName)
Locked by adark, Redbullusa, Thewsomeguy, and TheGuyWithAShortName
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?