How can I incrememnt a dictionary entry in a datastore?

  1. What do you want to achieve? Keep it simple and clear.
    Increment a dictionary entry, which is in a datastore.

  2. What is the issue? Include screenshots / videos if possible!
    I just can’t wrap my head around it, and I don’t know if it’s possible.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Read above.

Okay, so there is a function provided by Roblox called “IncrementAsync”, that you can use on DataStores, but your value has to be an integer. Try using this, tell me if it works.

It would probably look like this

dataStore:IncrementAsync(key, value)

The value is in a dictionary, though.

The datastore entry is made up of a single dictionary, so I don’t know how I would go about incrementing just one dictionary entry.

1 Like

I’m not going to ask any questions on why you would do this, but I would just extract the datastore, modify it, then set it again. That way you send the least amount of requests as possible.

This isn’t why I’m using it, but heres an example of why someone would put a dictionary for an entry. Thanks for the solution!

local storage = {
       ['Coins'] = 50
       ['Tokens'] = 7

1 Like

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