This problem is probably a simple issue, but I can’t figure it out. Essentially
Table1 = {
["Apple"] = 2,
["Orange"] = 3,
["Banana"] = 4
}
How would I make one of those values, using "Banana" in this example, to be incremented by 1, **without** the rest of the saved values being affected? Essentially, let's say there are two currencies, one named Coins and one named Gems. They are both saved in the same database in the same table. How would you increase coins by 1 without changing or affecting the values of Gems?
I really appreciate any help you can provide, thanks in advance.
You can create a new table but only change the value of Banana and use the UpdateAsync function to update the datastore with the newly created table
local fruitData = get the old table from the datastore before updating
local newData = {
["Apple"] = fruitData["Apple"], -- keep the values you don't want to change the same as the old data
["Orange"] = fruitData["Orange"],
["Banana"] = fruitData["Banana"] + incrementamount -- this increases the existing amount by however much provided
}
update the datastore with the newData table