How would I go on about saving a custom inventory?

Hello! I’m here to ask about one thing. How would I go on about saving a whole folder? I’m trying to make a custom inventory system, I have an idea how to make the inventory itself, however, I have absolutely no idea ho to make it save.

Any responses would be appreciated!

1 Like

When saving lots of data (and really any time you save data), you should use tables. Just gather the data, and insert it into the table, like so.

local playerData = {}

local function saveData(player)
    playerData.inventory = {}
    playerData.inventory.gun = folder.Gun.Name --gun data
    --insert other data you may need
    dataStore:SetAsync(player.UserId, playerData) --Probably should use update async
end

For more information on data stores and saving data, visit the page here.

3 Likes