Datastore request was added to queue with a number. How can I fix this?

Script:




local players = game:GetService("Players")
local DS=game:GetService("DataStoreService")
local DS2=DS:GetDataStore("CashValueSaver")
local DS5=DS:GetDataStore("WinsValueSaver")

players.PlayerAdded:connect(function(player)
	local folder = Instance.new("Folder")
	folder.Name = "leaderstats2"
	folder.Parent = player

	local currency1 = Instance.new("IntValue")
	currency1.Name = "Cash"
	currency1.Parent = player.leaderstats2
	currency1.Value = DS2:GetAsync(player.UserId) or 0
	DS2:SetAsync(player.UserId, currency1.Value)
	local currency2 = Instance.new("IntValue")
	
	

	currency2.Name = "Wins"
	currency2.Parent = player.leaderstats2
	currency2.Value = DS5:GetAsync(player.UserId) or 0
	DS5:SetAsync(player.UserId, currency2.Value)

	currency1.Changed:connect(function()
		DS2:SetAsync(player.UserId, currency1.Value)
	end)
	currency2.Changed:connect(function()
		DS5:SetAsync(player.UserId, currency2.Value)
	end)

end)


2 comments

0

You're trying to save the data too quickly, that is why you're receiving this error

0

How to make it save data less frequently?