How to update a specific value in a datastore?

I’m attempting to update a value that is inside of a key if that makes sense. I’ve tried everything but it doesn’t seem to update no matter what I do. not sure why datastores like to be so difficult, I’ve been scripting for many years but this has stumped me.

Essentially what I want to do is:

| Datastore
|-> Key
|->Table
|-> Value in table

In this instance i want to delete or set the value in the table to nil.

The way I’ve designed my datastore for this game requires it to store huge sums of tables in one key and I want to be able to erase a given table in the datastore.

I’m quite confused as to what I should do here so if I didn’t explain properly don’t hesitate to ask questions.

3 Likes

Hello! I’m not sure I understood. Is the value a string or a table?

I want to update the string value, assume there is a table inside of the key,

What?

1 Like

I think that he wants each key to hold a table of values as the data associated to the key

2 Likes

the value im trying to delete is a table, but regardless im trying to set the value to nil / erase it.

Let me rephrase the post, im trying to update a single value in a table thats saved to a datastore key and erase that value.

[Datastore] → Some Key → {[“cat”] = true}
I want to set cat equal to nil. You might say to overwite it with setasync but in my instance the key has thousands of other tables in it that i do not want to update, i just want to change that one specific value.

cant you just delete the key that you dont need?

I tried but it doesnt seem to update. If you refer to the post i updated it it should explain it a bit better.

ive tried using updateasync as well, it doesnt seem to update. something must be broken cause i just tested it in a fresh studio and it updates fine.

I literally re-launched my studio and it started working i have no clue how that fixed it but it did. UpdateAsync (which i had already tried before is how i updated the value)

1 Like

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