I have been having a problem with finding a good way to save a player's purchase data in the datastore. I tried to make every item in the shop have an int value then set the int value to true when the player buys the item then save the int value in the datastore, but this is just too inefficient when you have too many items in the shop.
I also attempted to make a table that has all the purchase data but I couldn't figure out how to save the table in the datastore or how to even get the table from a local script to a server script.
You can save your items name instead of using values. Then when you load their saved data just cycle through the table that you have saved in the datastore with a for loop. Then make a function that gives the player all their saved stuff.