Hello, I’m trying to send a table containing remotes created by the client to the server by using a RemoteEvent. The only problem is that remote events pass tables by copy instead of reference, so when I fire or invoke the remotes in the table from the client, the server won’t receive those signals (I don’t know if this works because I haven’t tested it; if this sounds bogus, please let me know). Is there a way to pass a table by reference through remotes?
This may not be the case for RemoteEvents and RemoteFunctions, but, in most cases, if not all, Instances created by the client are not replicated to the server. So, if you send Instances created from the client via Remote, the server will only receive nil values.
With that being said, couldn’t you just invoke the server from the client to get those Remotes, then call them? Here’s an example:
Server:
local getRemotesFunction = -- [The RemoteFunction's location]
function getRemotesFunction.OnServerInvoke()
-- Create the remotes, and parent them in ReplicatedStorage if needed.
local remotes = {}
return remotes
end
Client:
local getRemotesFunction = -- [The RemoteFunction's location]
local remotes = getRemotesFunction:InvokeServer()
-- Then call/invoke the other remotes.
1 Like
Thank you for clearing things up and the example.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.