Since Setasync dosen't have a end and its like weird
I got confused cause with setasync
you can just wrap it around simply
but I don't think I did my UpdateAsync right
The S prints true and E prints a table but I was wondering what that table was and if I did this right
local S,E = pcall(function() local UpdateAsync = DataStoreOfStats:UpdateAsync(Player.UserId,function(OldValue) return OldValue end) return UpdateAsync end) print(S,E)
You don't need to set the function to a variable. The pcall wraps whatever is inside of it and since UpdateAsync returns a result if it works, Success will return true or false based on whether it saved correctly.
local Success, Result = pcall(function() DataStoreOfStats:UpdateAsync(Player.UserId, function(OldValue) return OldValue and OldValue + 1 or 1 end) end) print(Success and "Saved" or 'Failed', Result)