Saving backpack tools

Hey,
I have a shop where you can buy tools, but when the player dies, the tools disappear, and also when you leave. I want the purchase to be a one-time purchase so that they never disappear. I got a lot of tools and planning on adding more, so the method of storing should be easy to replicate.

What I have tried to do is make a folder inside the player, where all tools he has bought are stored, and whenever the player respawns, just clone the tools into the player’s backpack. The issue is when the player leaves, how would I go about and create a data storage for a folder with tools in it? Can data storages store whole folder/files? If so, how would I go about doing this?

Another thing I have thought of is making a data storage for each tool, and just give it a bool value, true if the player owns, false if he doesn’t own it. But I feel like there’s better ways to do this.

If you have any other way to do this that’s easier and more effective plz say so.

Thanks in advance.

Have you looked into Roblox’s DataStore? I believe this is what you need.

1 Like

Additionally to the aforementioned, save any identifiers for the tools. For instance, you have a rocket launcher called RocketLauncher and you’ll save the string "RocketLauncher" into a table. Save the table by using the data stores.

Booleans are not needed, just check if the string exists within the table after loading by using table.find(loadingTable, toolName). Loading the tools to the players is to re-use the identifiers and then clone the tools to the folders again.

2 Likes

Yeah, I’ll do that. That seems wayy better than making a bool for each one, because on this one it only stores the tools that the player owns, not the ones that he doesn’t own.