There is a max datastore queue limit to how many SetAsync()s you can do. Since you are sending so many, ROBLOX takes either forever to save it or doesn’t at all.
Instead of using so many datastores, just use 1 and use a table to store the data. What you’re currently doing is inefficient.
So I’ve heard… I actually attempted saving with tables, but I just got confused. Is it possible you could lead me in the correct direction with the table saving?
What @zQ86 means, is to save Player’s data in a table and save it using only one function of :SetAsync() instead of four different functions. They also meant to simply use one Data Store, as multiple will probably cause you to lose track when saving Data.
Here is a snippet of what you’re could should resemble.
local DSS = game:GetService("DataStoreService")
local Storage = DSS:GetDataStore("#^$^#^$^$@^%@$&@@&@^%$@^")
game.Players.PlayerAdded:Connect(function(player)
local defaultMax = 25
local xpHolder = Instance.new("Model")
xpHolder.Name = 'XPMODEL'
xpHolder.Parent = player
local folder = Instance.new("Folder")
folder.Name = "leaderstats"
folder.Parent = player
local money = Instance.new('IntValue')
money.Name = 'Coins'
money.Parent = folder
local currency = Instance.new("IntValue")
currency.Name = 'Survivals'
currency.Parent = folder
local xP = Instance.new('IntValue')
xP.Name = 'EXP'
xP.Parent = xpHolder
xP.Value = 0
local gemCur = Instance.new("IntValue")
gemCur.Parent = player
gemCur.Name = 'Gems'
gemCur.Value = 0
local maxExp = Instance.new("IntValue")
maxExp.Name = 'MaxExp'
maxExp.Parent = player
maxExp.Value = 25
local level = Instance.new('IntValue')
level.Name = 'Level'
level.Value = 1
level.Parent = player
local maxInc = Instance.new('IntValue')
maxInc.Name = 'maxInc'
maxInc.Value = defaultMax
maxInc.Parent = player
money.Value = data1:GetAsync(player.UserId) or 0
currency.Value = data2:GetAsync(player.UserId) or 0
xP.Value = data3:GetAsync(player.UserId) or 0
gemCur.Value = data4:GetAsync(player.UserId) or 0
game.Players.PlayerRemoving:Connect(function()
Storage:SetAsync(Player.UserId.."~Data", {money.Value, currency.Value, xP.Value, gemCur.Value})
end)
end)
If you set the DataStore name to something like “XP”, it is easy for other Developers to use that DataStore name also since it’s common. This will only happen if the keys they use
Storage:SetAsync(Player.UserId.."~Cash", 0)
this part ^^^^^^^^^^^^^^^^^^^^^^