How can I manage quickly using Database: GetAsync or Database: SetAsync without getting errors about my queue being full. Usually, if it is full, it would discard the changes. This would be a problem when saving data for obvious reasons. What is the best way to handle this?
This should work, It's added to a indexed table then saves when left. I've never had a problem with this.
I don't believe you will need a queue but if you do you could use 60 + numPlayers × 10
link to datastore Errors and Limits: https://developer.roblox.com/articles/Datastore-Errors
local plrs = {} -- table that players get indexed into local datastore = game:GetService('DataStoreService'):GetDataStore('PlrData') local cansave = true game.Players.PlayerAdded:Connect(function(plr) local suc,data = pcall(function () return datastore:GetAsync(plr.UserId) end) if suc and data then plrs[plr]={['Gold']=data.Gold}--indexed table elseif suc then plrs[plr]={['Gold']=0} end end) function save(plr) datastore:SetAsync(plr.UserId,plrs[plr]) cansave = true end game.Players.PlayerRemoving:Connect(function(plr) if cansave then cansave = false save(plr) end end) game:BindToClose(function() -- saves everyone's data when game closes for _, plr in pairs(game.Players:GetPlayers()) do if cansave then cansave = false save(plr) end end end)