So I am working on a voting system, and I want to send the options to be displayed on the client. The way I am doing this is through a RemoteFunction, but something very weird happens when I try to.
Server Code:
remotes.GetOptions.OnServerInvoke = function(player)
print(#options) --Outputs 3
return options
end
Client Code:
local options = remotes:WaitForChild("GetOptions"):InvokeServer()
print(#options)
For your information, remotes is simply a reference to game.ReplicatedStorage and options is the table I am using. The issue is that the table on the server is completely fine (it prints 3 when I try to get its length, which are how much options there are), but when it is sent back to the client, there is nothing in the table (#options prints 0). Can someone help me?
It could be possible that me putting maps into ServerStorage might have messed with the table. I will make a couple modifications and see if I get any results.
Ok so from my understanding, Like @blokav said you can’t send mixed tables through remotes. you will have to make a separate variable for the value to be printed in the clients. When the output is 3 then you want to make a function where the variable’s value in client code changes.