Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this RemoteFunction always return an empty table?

Asked by 7 years ago
Edited 7 years ago

I'm learning how to use FilteringEnabled, and despite my best efforts, I can't figure out why or how this doesn't work. There are two scripts, one on the server side and one on the client side in a local script.

--SERVER SIDE:
--(assume "remote" variable is a RemoteFunction)
function getItems(plr)
    return game.ServerStorage.Items:GetChildren()
end
remote.OnServerInvoke=getItems
--CLIENT SIDE:
--(assume "remote" variable is the same RemoteFunction)
local remoteItems=remote:InvokeServer()

Here is all of the info I've been able to get so far: -The server side script returns a table with 1 item in it. -The client side script receives a table with no items in it (NOT nil). -Therefore, there must be something happening between the data send and the data receive.

Any help would be MASSIVELY appreciated, as I really want to drive my head through the screen right now.

1 answer

Log in to vote
1
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
7 years ago

Objects in ServerStorage are not visible to LocalScripts. Since LocalScripts don't recognize those objects, they just get replaced with nil when you try to send them over the network.

You could do something like send a copy of all of the children, or something else.


Why do you just want to share everything in server storage? That defeats the point of ServerStorage.

0
Thanks so much! I definitely could have assembled the framework better, but for now I just have to work with this. ChipioIndustries 454 — 7y
Ad

Answer this question