Datastore Saving Question

I’m incredibly new to Datastores and so far… I hate them… I hate them a lot… but I gotta learn how to do this (regardless of my hatred) so here I am.

My question:
I’m creating a system that needs to save items like clothing, helmets, tools, etc. and I’m wondering if this (below) is a viable way to do so or if it’s gonna make my game implode.

I figured I’d put all of the items from the game in a series of folders and pretty much just loop through the folders and place them into categorized tables within the player’s main table + a bool that details whether the player own’s the item or not.

PlrTable {
     PlrOutfits{
          PinkOutfit = true, -- The items inserted from the loop
          BlueOutfit = false, --  The bool for whether the player owns it or not
          OrangeOutfit = false
        }

     PlrHats{
          BlueHat = false,
          GreenHat = true, 
          PurpleHat = true
        }

     PlrTools{
          Shovel = true,
          Flashlight = true,
          Grenade = true
        }
   }

So what I’m asking is whether this is a good, and somewhat efficent way to save or if there’s another route I should go.

Thanks for reading and helping me out!

You’re about to hate datastores a lot more: You can’t save objects to datastores.

This is pretty efficient but can run into problems. What happens when you rename PinkOutfit to something like MagentaOutfit?

@Azurlified they’re not saving objects at all, just their names

Oh I’m actually aware, I’m just saving the names of them and fetching the items later via other methods.

Oops sorry, I didn’t read the code my bad :), I’ll write up a solution right now

Well I won’t be manually naming them in the script, for example the outfit would be in its own folder named “PinkOutfit” and the name would be fetched by the script during a loop prior to actually saving the table to the player.

Edit: The loop would go thru something like this,

image

and fetch all of the items and the categories they are in.

You can save strings, you can save anything!
Make your own “encoding” and “Decoding” to get information about the object and create it.

I know I can save the strings, I’m asking if my method of doing this is effecient.

I’m not really looking to make objects, rather just check if a player owns an item and cloning it from storage.