Help keeping track of user data

I am interested in the best way to handle user data specifically in relation to tools, weapons etc. Ideally every weapon would be unique. I’m thinking just saving all the associated stats of each tool to the datastore to the player, the issue I have is keeping track of this tool on the server, should I be using strings to try and identify the tool, like a unique name or should I use tags? How do you go about doing this.

You’re correct in assuming that you need to save the stats of the tool, as saving instances is simply just not possible with datastores. The term you would be looking for is called Serialization. This post explains the concept of serialisation better than I could here.

Essentially, you would need to convert the tool into datatypes that can be saved, such as strings, integers and floats (as well as tables). After serializing the necessary data, you could then store it as a table and save it. When a player joins the game, apply the saved table to the player, be it whether giving them the tool and/or applying stat changes to the tool. You don’t need to save how much damage the weapon does, since the tool itself will already have this data. Rather, you would want to serialise unique data. For example, if the player has made a change to the tool that the original tool does not have (such as an enchant or stat boost) you would want to serialise that and save it as that is a unique piece of data - alongside the name of the tool itself because otherwise you would not know what tool is being saved.

Below is a diagram of how serialization works, provided from the post mentioned above: