You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I am trying to save properties of a (players) part to a datastore
-
What is the issue? Include screenshots / videos if possible!
I don’t understand the 2nd argument of updateasync()
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried discord servers and searching the web but i still do not understand it
My code:
func.OnServerEvent:Connect(function(plr, properties)
print("GOOD")
local userID = plr.UserId
local key = "Player_"..userID
local success, ret = pcall(datastore.UpdateAsync, datastore, key)
if properties then
datastore:UpdateAsync()
end
if success then
properties = ret
else
repeat
waitForRequestBudget(Enum.DataStoreRequestType.SetIncrementAsync)
local success, ret = pcall(datastore.UpdateAsync, datastore, key)
print("Error saving data (Please retry?)".. ret)
until
success == true or not Players:FindFirstChild(plr.UserId)
end
end)