I have a simple datastore which can save the name of a StringValue and load it back to the player using:
--// Just the saving
local inventoryFolder = plr:FindFirstChild("inventory")
if inventoryFolder then
local InvToSave = {}
for _, v in pairs(inventoryFolder:GetChildren()) do
if v then
table.insert(InvToSave, v.Name)
end
end
if InvToSave[1] then
--// Saves the StringValue name to load later
Inventory:SetAsync(plr.UserId, ActualInventory)
end
end
I do it this way because all the players have a physical folder called inventory. Probably not best practice but easier for me.
My question is how would you also save the StringValue value?
Using this example table below, I can only save Apples and Oranges but I also want to save the extra data they contain which would be the StringValue value.
local inventory = {
Apples = {ExtraData = “Red”},
Oranges = {ExtraData = “Orange”}
}
