Im making a shop for my game. And to make a shop, i need to get information about the items to properly display them. The information is stored inside the ServerStorage and the shop is run in a LocalScript, so i need to use RemoteFunction to return some info. However, when it returns and i run a for loop on the variable, it seems like it returned nothing because print is not showing anything.
Heres my code:
-- Local script
local shopitems = game.ReplicatedStorage:WaitForChild("Remotes").GetWepStats:InvokeServer()
for i,v in pairs(shopitems) do
print(v.Name)
end
-- Server script
game.ReplicatedStorage:WaitForChild("Remotes").GetWepStats.OnServerInvoke = function(p)
local things = {}
for i,v in pairs(game.ServerStorage.WeaponStats:GetChildren()) do
local clone = v:Clone()
table.insert(things, clone)
end
return things
end
“WeaponStats” is a folder that has more folders containing information about each item. The output does not print anything when the for loop is ran. Any ideas on what’s causing this?
