Datastores - First time using Update Async

Hi there!

So currently im working on an equip event. It works like this:

  1. Player clicks on an image button on their client, and sends the value over to the server using remote events.
  2. Server gets the value and updates the data store with that value.

The datastore is organized like this:

CharacterData:GetAsync(key)
returns: {Value1, Value2, Value3, Value4}

So to set the new player data after the server receives the value, the server script would look like this:
(This is in an OnServerEvent function)

local CurrentData = CharacterData:GetAsync(Player.UserId) -- Current Data is: {Value1, Value2, Value3, Value4}
local success, errorMessage = pcall(function()
  CurrentData[1] = Value2
  CharacterData:SetAsync(Player.UserId, CurrentData)
  UpdateEvent:FireClient()
end)

But using SetAsync is bad for updating player data and I want to use UpdateAsync. What are ways to go about this?

Hello King King King,
This might be helpful: GlobalDataStore:UpdateAsync GlobalDataStore:SetAsync