How would you suggest I approach a shop and inventory system? Particularly the inventory aspect of it. I’ve considered saving a inventory table consisting of the player’s inventory that’s stored inside an inventories table, and then saving the inventories table. I’m not sure how efficient this is.
If this is the most efficient approach, how should I save the items inside the tables? Should I associate them with a name, should I ID them? What should I do?
Wait first off I need to know. Do you want it to save across servers? You most likely do, but it is still worth asking. If so I will begin making a script for that! Also I need to know the amount of slots the player will have in their inventory. Also can I get the GUI you are using for this inventory system?
Yes, saving with datastores. 2) It’s an inventory, not backpack. 3) I’m not asking for someone to write it for me, I just am asking for advice on an approach.
If you want a player to have an unlimited amount of items you could simply store each item they pick up in a table and save that so if you want to display what they have you simply loop through the table and make each inventory slot accordingly
but what i would do is setup a custom GUI with a set amount of slots and just make a script in ServerScriptService as i would make a data store script and use it to make an inventory system that would save across servers using datastores. Im working on a visual example to show what i mean
with roblox datastores. You would simply store the table of all the data instead of an individual value. If you want to be super secure you can use a prebuilt module like profileservice or datastore2 so you dont have to worry about saving messing up
thats not the same as saving items. Thats how to format your table. So yes, you are not being very clear. What I would do? It depends on the system. If each item is unique I would generate a GUID for each new item but if its a simple item that the player will have a quantity of I woudl simply store how much the player has as an integer in the table. It just depends on hwo your system is designed and how you liek to format your tables.
saying my post was clear enough when I had to reread it multiple times makes your statement invalid
A GUID is defined as " **GUID** (aka UUID) is an acronym for 'Globally Unique Identifier' (or 'Universally Unique Identifier'). It is a 128-bit integer number used to identify resources. The term **GUID** is generally used by developers working with Microsoft technologies, while UUID is used everywhere else." It is basically a unique ID that when is created is going to be a set of numbers that has never been made before, hence, an ID. You can generate a GUID with the function GenerateGUID of httpService. Dont forget to mark my post as a solution if this helps.