How to pass values through a RemoteFunction being invoked to the client

  1. What do you want to achieve? Sending data from the server to the client using a RemoteFunction.

  2. What is the issue? I cannot figure out how to do it.

  3. *What solutions have you tried so far? Looked on the dev hub and looked on the documentation.

Below is an example of the issue.

local function testFunction(test)
	print(test.." was the value")
end

event.OnClientInvoke = testFunction() --cant figure out how to pass the values through

Sorry if this sounds like a really stupid problem :smiling_face_with_tear:

Assigning it to testFunction() (with brackets) will run testFunction and assign OnClientInvoke to the return result of it.

Assign it to testFunction (without the brackets) and you’re assigning the function itself, which should pass just fine.

event.OnClientInvoke = testFunction

Note using InvokeClient is generally not recommended as exploiters can abuse it to infinitely yield server code and can eventually lead to your game crashing from lack of available memory if too many threads get yielded.

Don’t worry, it’s not a stupid question. We all start somewhere.

1 Like

Thanks alot for the help!

Sorry it was a stupid question :smiling_face_with_tear:

1 Like