Ive got a script to loop through a players inventory and create a table out of the items inside it and want to send this to the client to then do things based on if each item is owned rather than having to check and send for each item individually, I have created the table on the server which prints fine, but when it comes to the local script it doesnt retrieve it properly
This is my server script:
which prints this:
This is the local script: (can ignore most of it, just testing the table before doing anything with it)
Which prints this:
(which is what the table is originally set at in the serverscript)
Any idea how to load the table properly as im cleary doing something wrong
I’ve just realized I believe your item’s are in ServerStorage ?. If so, anything within ServerStorage and ServerScriptService, do not replicate to the client, try moving it to ReplicatedStorage.
Ah thatll be why then, would it not be possible to print the results of the table as a string to send to the client? wont be able to change it to replicatedstorage without a lot of effort changing every script, would be easier though less organised to just check for each weapon individually by name and sending each one to the client
You could have a folder for the client in ReplicatedStorage, and parent a copy to that folder like:
for _, Item in ipairs(inventory1:GetChildren())do
local clientItem = Item:Clone()
clientItem.Parent = ReplicatedStorage > -- folder for the player, or just workspace if needed
Inventory1Owned[Item.Name] = clientItem
end
You can also just parent the original without needing to clone if desired.