Here is my server-side code:
local PFsearch_RF = game.ReplicatedStorage:WaitForChild("PFsearch_RF")
local PFitems = {}
function PFsearch_RF.OnServerInvoke(player)
PFitems = {}
local PF = game.ServerStorage.Inventories:WaitForChild(player.Name)
for i,v in pairs(PF:GetChildren()) do
if v:isA("Tool") then
table.insert(PFitems,v)
end
end
return PFitems
end
And here is the client-side code:
local PFsearch_RF = game.ReplicatedStorage:WaitForChild("PFsearch_RF")
function backpackRefresh()
items = {}
local PFitems = {}
PFitems = PFsearch_RF:InvokeServer(player)
for i, v in pairs(PFitems) do
table.insert(items, v)
end
search(char) -- Ignore these 2 functions, search and refresh, please. They work and I can guarantee they are unrelated to the issue.
refresh()
wait()
end
backpackRefresh()
(BTW, player.Name is a server storage folder of tools for each player)
Testing it with print commands on the server side, the array PFitems does contain 1 tool when I run it. However, the client reports that it is empty. I can't see why it won't return properly. Can someone explain what I am doing wrong?
Sorry if I left out some important details, please let me know if so.

3 comments
Thanks for the reply. I changed my code to this, but it still returns an empty table, though..
Because in your server code, PFitems is always empty when you set it to {}, so you are returning an empty table.
Actually, I figured out the issue. It had nothing to do with my code, I'll elaborate in the "Answer".