I used to use update async and recently I started developing a new game and I'm having trouble with the update async. These are the variables
local gui = game.ServerStorage.Overhead--ignore its useless
local ds = game:GetService("DataStoreService")
local skill = ds:GetDataStore("Levels")
local key = "-level"
Then this is the part of the script that doesn't work
game.Players.PlayerRemoving:Connect(function(pla)
local suc, err = pcall(function()
print('hi')--prints
skill:UpdateAsync(tostring(pla.UserId..key), function(oldval)
print('update')--doesn't print
if tonumber(oldval) == nil then print("it is nil and saved") return pla.leaderstats.Level.Value end
if pla.leaderstats.Level.Value >= oldval then
print('returned more')
return pla.leaderstats.Level.Value
else
print('less than save')
return oldval
end
end)
end)
end)
NO ERRORS

4 comments
yeah i tried doing warn(err) but success is true
im using updateasync and my problem is updateasync not the status or the success its the function not calling
So that would mean UpdateAsync is running, it's your saved value that is not what you expect it to be. Make sure Level.Value is correct and that it's not hitting the oldValue condition.
it doesn't even run anything inside updateasync doesn't work