Hello.
When I do that, it works.
local dataStore = game:GetService("DataStoreService")
local dataPlayers = dataStore:GetDataStore("DataPlayers")
local function IncGold(data, keyInfo)
data.gold += 50
return data
end
dataPlayers:UpdateAsync(tostring(player.UserId), IncGold)
But I would like to change the value to increase.
Like this :
local function IncGold(goldAdd , data, keyInfo)
data.gold += goldAdd
return data
end
dataPlayers:UpdateAsync(tostring(player.UserId), IncGold(goldAdd))
I know this code is not working because it returns goldAdd, nil, nil.
But why can’t an Update function, like UpdateAsync, pass a simple argument, the value to update?
Is there a way to do what I want with UpdateAsync or do I have to do a GetAsync, change the data then SetAsync?
Thanks for your help