Hello. I’m currently using DataStore2 to save values of BooleanValues in a folder in the player. It works but I feel like there’s a better way to save data other than this. How should I go about saving it? Should I save it into a table? If so, how do I transfer the data from the server to the client for UI purposes? My inventory system doesn’t support having multiple instances of an item so I wanna know how I can improve the system right now before it’s too late.
Use a table of boolvalues. There are hundreds of tutorials online. Also, is there a specific reason you are using DataStore2?
I’ve heard good things about DataStore2, so I decided to use that. Is there a tutorial you recommend?
I’m usually pretty skeptical when implementing newer features into games, but this one seems pretty well tested. Here’s the link to a really good “all around” tutorial.
If you don’t understand anything, scroll through the comments or reply to this
How would I transfer the data from the table to the client so I can use it for the UI?
Pretty simple.
Make a localscript named “inventoryHandler” or something, and add a folder as well.
For each value in the players inventory datastore, insert an intvalue into that folder, and change the name to whatever the item name is. After that, change the value to however much of that item the player has (if you want to implement that). Then, make a template icon, and clone it and change it for each item in that folder.
I reccomend using :GetPropertyChangedSignal() or a remote event to detect when new items are added to the inventory, and update the code accordingly.