How to save tools?

BEFORE starting the question I would like to say this, I have a request to you not to write an answer like use dataStore. Please describe everything and tell me how it all works. Thank you, so let’s get to the question. And yes, it’s not going to be an easy one.

So I have an item store, here it is:

if it’s a dumbbell store, it’s a food store.

a player can buy an item from this store. Initially, he has nothing in his hand. But after buying and pressing the equip button, he buys the item and it is given to him from the replicatedStorage.


He can also, for example, buy food, so an old item is thrown into his backpack. According to my logic,


a player can have at most 2 items (dumbbell and food) one of which is in his hand and the other in the backpack

But, for example, if a player wants to buy a new dumbbell, he buys it, the new one is given to him in his hands, and the old one is moved to the tools folder inside the player.

so the player has four places to tool up.

1. Hands(character)
2. backpack(player)
3. tools folder(player, this is if he bought but for example uses a newer dumbbell).
4. RP(Tools, this is if he didn’t buy and it’s just like a store).

So I hope I’ve explained everything correctly, let’s get to the question!!!

But when the player leaves everything is reset and when he enters the game again his hands are empty, and everything else is also empty. So I want to make a save. What kind? I explain, for example, the player left with dumbbell2 in his hands, then when you re-enter the game his dumbbell2 remains in his hands.

He had food3 in his backpack when he exited, so when he comes in, food3 is still there. By the same analogy works and player’s folder tools, and replicated storage (shop). That is, I want that at a new entrance to the game all that was so and remained.

Also, an additional part is that in the store all the buttons are also saved. Like that dumbbell2 was bought, so there is no buy button in the store. Anyway, I hope you understand.

So, I have a problem with the fact that this is an unusual saving of items because I kind of need to save 4 items. And I’m hoping that you can help me with my problem.

So let’s summarize!!!

I would like to get a detailed answer (of course I would like scripts, but if it is difficult for you, you can just write how and what should work). In general, I hope for a big and detailed answer, not something like: use dataStore.

And yes, if you need my scripts that I have already written, I can give them, but again they are poorly done(BUT on the store and purchase I have scripts). But for saving no. So kind of all scala hope for an answer, and thank you for your attention)

P.S. 2. Please do NOT write something like use dataStore, here is the link. NO!!! Please, if you give an answer, give it in detail, because I already know that I need to use a ds, I even save data in the game using it, but only for tools you need to use also ds but a little differently so please write something like you need to do this, this and here is an example. I hope you understand what I mean, thank you.

2 Likes

I’m not quite able to follow you with your ordering, but you can save the name of the tools, in an array, to the datastore. For example:

{NameOfToolInHand, NameOfToolInBackpack, etc. ...}
1 Like

Use DataStore2, it is significantly easier to use than the default datastore system.

It’s a module that you can get from the GitHub: DataStore2

I think you should track where each item/tool is in the datastore while the player is playing. For example, you can organize a table kind of similar to this:

{
    Hands = {
        "Dumbell1",
        "Dumbell2",
    },
    Backpack = {
        "Mass1",
        "Mass2",
    }
}

With regular datastores, it can be annoying converting your data to a string because it does not support tables. DataStore2 will do all that annoying stuff for you, and the GitHub page has documentation to make it much more easy to understand.

When the player rejoins, just read their datastore and insert the tools into them based on where they were saved in the datastore.

When a player buys food and an old item is thrown into their backpack, update the datastore to account for that.

DataStore2 will automatically cache data in the server, autosaving periodically, and save whenever the player quits, so you don’t have to worry about overloading it with too many requests, or data loss.

I hope this helps :slight_smile:

1 Like