hi, i was working at a Custom DataStore, all works but i want to make a sistem that saves all the saves the player leave, to can make a anti data lose and to can make to load a old save, but my code don’t work it returns nil but i put if the data is nil to return {}
the code:
function HiddenAddons:GetFromValues(plr,key)
if DSS:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.GetAsync) > 0 then
local data = DSS:GetDataStore(key.."__"..plr.UserId):GetAsync(plr.UserId)
if data == nil then
data = {}
end
spawn(function()
return data
end)
else
wait(10)
local data = DSS:GetDataStore(key.."__"..plr.UserId):GetAsync(plr.UserId)
if data == nil then
data = {}
end
spawn(function()
return data
end)
end
end