How do I properly use UpdateAsync()

Hey, so I was thinking how I could really implement UpdateAsync().
I read the api documentation, but couldn’t really get it working, I still have problems retrieving it. I would appreciate the help! :slightly_smiling_face:

datastore:UpdateAsync("key", function(old)
  return "funni " .. old -- return <value>
end)

How do I retrieve it? That’s the main question.

Just do it the normal way, it doesn’t change when you use UpdateAsync:

game.Players.PlayerAdded:Connect(function(Player)
    local Data
    local success, err = pcall(function()
       Data = DataStore:GetAsync(Player.UserId)
   end)

    if success then
      -- Load data
   end
end)
2 Likes