Remote Function is acting very weird

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?

What are the contents of ‘options’? You can’t send mixed tables through remotes, or tables that have metatables.

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.

1 Like

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.

The contents of ServerStorage are inaccessible to clients, so any references to Instances in ServerStorage will be nil when sent over to the client.

3 Likes

Bingo! We have a winner! This was a relatively simple fix, just the little things that I forget here and there, hehehe…