Saving Player Tools

This has been a topic that many people have talked about, but I feel like mine isn’t as cut and dry. In my system, the tools have different values associated with them. For instance, I could have a weapon that has a level. You level up the weapon and that increases it’s damage. I can’t save tools in a datastore because I have data that’s unique to the user AND the tool. So, I can’t just store the tool by its name into the datastore, because that cuts out the other vital information, like the tool’s level.

So, should I just create a folder for each player that stores the player’s tool objects? Is that even possible? Will that save across servers and sessions?

1 Like

How to save your players' inventory items Might wanna rewrite it though, It does not use any error handlers.

This uses DataStores to store tools by their name. This is specifically what I said that I can’t do because of the way the tools are set up. Each tool is unique, so drawing from a list of prefabbed tools and just comparing their names doesn’t make sense.

It loops through the player folder and saves them?

I would suggest saving each tool’s stats in a table.

Essentially, save one big table to a datastore containing smaller tables that store important information about each tool.

Keep a folder of template tools somewhere in ReplicatedStorage or ServerStorage and clone them into the player’s inventory accordingly, then apply the properties and values specific to each tool from that datastore.

1 Like

This is a better option. I just need a unique identifier for each tool. For instance, instead of just having “sword”, I would have to have “sword_12345” so that I can pair each tool to their respective data in the datastore. So I wouldn’t necessarily be storing the tools, just their data, then cloning that data to the templated tools from ReplicatedStorage or ServerStorage.

Thanks, that helps!

1 Like

Correct!

Here’s a visual representation of how the table would be structured:

local DatastoreTable = {
	["EpicSword"] = {
		["Level"] = 9000,
		["Epicness"] = 999999,
		["Swordness"] = 99999,
	},
	["NotSoEpicSword"] = {
		["Level"] = 2,
		["Epicness"] =3,
		["Swordness"] = 50,
	}
}

Tables and dictionaries are a blessing. :pray:

1 Like

Looks like I finally got it working. Thanks a bunch!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.