Hi! I've been receiving this error when trying to save a players wins, the error I got was Callbacks cannot yield, I was wondering what part of the code caused it and why? Any help is appreciated :D
local Success = false
local PlayerId = ("PlayerID_"..Player.UserId)
local WinVal = Player.leaderstats.Wins.Value
local successfulSave,ErrorMessage = pcall(function()
GameDataStore:UpdateAsync(PlayerId,function(OldValue)
if WinVal >= OldValue then
GameDataStore:SetAsync(PlayerId,WinVal)
else
GameDataStore:SetAsync(PlayerId,OldValue)
end
end)

1 comment
didn't know about the return OldValue - learnt something new, cheers :D