So I’m just trying to upgrade my scripting skills here if you know what I mean, but anyways I have some troubles I need to explain with creating an inventory.
How do I save something and place it in it’s own table using a DataStore? (Inventory)
What’s the difference between OrderedDataStore and DataStore?
These two questions have been holding me back (and yes they may not be correctly worded because I’m bad at explaining things), and I’d like to know if there’s anyone out there who can help me with them.
Sorry if some things are messed up I’m typing on mobile
OrderedDataStore vs DataStore
Regular DataStores, as you may know, are things where you can save data to in a “key:value” fashion. With these, the value can be anything, whether that’s a string, a table, or whatever.
OrderedDataStores are similar to DataStores except for the important fact that the values can only be positive integers. They do this so that the data can be sorted. So, if you tried to do OrderedDataStore:SetAsync(“Sam”, “Random string”), then it would error.
Inventory
You cannot save instances such as parts or meshes to a datastore, so generally what I see people do is save its characteristics like this:
Thanks for showing me how to SetAsync with a table, but it’s inside of 2 tables so what can I do to check if a player has “Celestial Sword”? (Also I totally understand why each table is for a different item, I just want to know how to access/check if a player has them)
Other than that I now can understand the difference between OrderedDataStore and DataStore, so thank you for that.
??? I’m confused on how to access it still, I don’t understand how the function you made has anything to do with finding a certain item inside of the table.
I changed it to “GetItem” for clarity. Basically the inventory variable inside of pairs() is the table which represents the inventory, which is the table we used in SetAsync(). GetItem(ItemName) would search through every item in their inventory and check to see if any of the items in said inventory have the same name as ItemName. So, say if you wanted to retrieve “Fiery Dagger” from their inventory, you’d do