Help needed with Datastore 2

So I am creating a Tool safe system for my game. I am using the DataStore2 system.
I would like to have it save “Metadata” about the tool to allow users to safe customised weapons. This would include:

  • Original Tool name. (String)
  • Number of Magazines. (Int Value)
  • HasCustomColour (Bool). If so set R,G.B values into 3 Separate Int Values.
  • HasCustomName (Bool). If so set the weapon name to the custom name (String).
  • HasCustomMaterial (Bool). If so set the material of the weapon to the saved Material (String).

Any other Metadata needed about the tool. (Dosent have to be a Weapon)

So far it only saves the Name of the tool inside of the Slot Number.
Slot1 has a Value of “Glock 17” however the Metadata values are left blank or Integer Values are set to 0. meaning metadata was not saved.

It does say that it “saved Data” but when re-joining to check, Metadata is not saved, only the value of the weapon name and that’s it.

The scripts do use GetDescendants and checks for all types of allowed Values.

I have tried re-Shaping and re-Scripting my safe script using Folders however the outcome is always the same.

If anyone can help / give me advice on how to get it to save the Metadata as well it would really help me out a lot!

All I see is that you’re inserting in the table. Can you provide the full code? Where do you use :Set() to save it to the datastore?

Hey. About your request.

I tried searching for :Set() inside the full script provided but I couldn’t find it. I even searched throughout the entire Datastore 2 System and there was no sign of :Set()

This is the link of the script i am using.

Set is a basic method that is used in DataStore2 to update a datastore. Go through the example from the OP here to see how it’s used:

Also check the official documentation, there you’ll find useful methods you might need:

Hey thanks for the advice,

However I might of came across a new approach (Tested above). Hopefully it goes well when I implement it.