- I wish to understand this one problem
- I tried going on the devhub but that didn’t really help much.
Do you just want to know how this works?
Well, you invoke the server on the client with RemoteFunction:InvokeServer()
(which is the intended use of this, server>client>server is risky)
local remoteValue = RemoteFunction:InvokeServer()
the server connects the invoke to a function,
RemoteFunction.OnServerInvoke:Connect(function()
return "Hello, world!"
end)
--OR
local function MyFunction()
return "Hello, world!"
end
RemoteFunction.OnServerInvoke:Connect(MyFunction)
returns a value, part, or anything else (in this case it’s the string “Hello, world!”)
And the client can use that value for whatever it wants.
local remoteValue = RemoteFunction:InvokeServer()
print(remoteValue)
RemoteFunctions are like RemoteEvents, but the server can communicate back to the client (2 way communication)
Is that what you were confused about?
Okoh so it’s basically like 2-way communicate
Alright cool I thought something else
Anyways thank you
2 way communication between scripts of differing classes only, one script invokes another through "InvokeClient()/InvokeServer(), the other script sets up an event listener which is the corresponding On[Server/Client]Invoke event.