Only changing one value of DataStoreService's table?

If I saved data like this:
{test1, test2, test3}

then is it possible to only save test3 to other value?

it should not overwrite any other value, since I got several place that uses same data store and when it saves in that place, spawn place’s save shouldn’t just blow that data

I would say it is not efficient to store the same value that is already a part of a table in 2 different Datastore keys. However, if you want to do so, you can get the value of the table using tablevariable[3] (considering test3 is in the 3rd position.)

You can use UpdateAsync(). That will help you.

1 Like

If you saved data as a table to one datastore you would need to grab the current data store table, then change the value you want then save it again. Or use the UpdateAsync as suggested above by Tengarapatu.

yourDataStore:UpdateAsync(Key, function(oldValue)
    -- update the value you want to change here then return it
    return newValue
end)

Make sure to wrap this in a pcall in case it fails so it won’t break your script.