DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Data Store

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    A global leaderbaord

  2. What is the issue?
    I keep getting an error like this “DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Data Store”

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

So I have like a datastore for leaderstats that have Coins and I have another datastore for the leaderboard in the script for Coins! I keep getting an error even if I take coins out of the datastore in leaderstats.

Leaderboard script

-- [ SETTINGS ] --

local StatsName = "Coins" -- Your stats name
local MaxItems = 100 -- Max number of items to be displayed on the leaderboard
local MinValueDisplay = 1 -- Any numbers lower than this will be excluded
local MaxValueDisplay = 10e15 -- (10 ^ 15) Any numbers higher than this will be excluded
local UpdateEvery = 10 -- (in seconds) How often the leaderboard has to update

-- [ END SETTINGS ] --






local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetOrderedDataStore("DataStoreV6" .. StatsName)
local SurfaceGui = script.Parent
local Sample = script.Sample
local List = SurfaceGui.Frame.List
local ItemsFrame = List.ListContent.Items

local function GetItems()
	local Data = DataStore:GetSortedAsync(false, MaxItems, MinValueDisplay, MaxValueDisplay)
	local TopPage = Data:GetCurrentPage()
	
	ItemsFrame.Nothing.Visible = #TopPage == 0 and true or false
	
	for i, v in ipairs(TopPage) do
		local UserId = v.key
		local Value = v.value
		local Username = "[Not Available]"
		local Color = Color3.fromRGB(38, 50, 56)
		
		local Success, Error = pcall(function()
		 	Username = game.Players:GetNameFromUserIdAsync(UserId)
		end)
		
		if i == 1 then
			Color = Color3.fromRGB(255, 215, 0)
		elseif i == 2 then
			Color = Color3.fromRGB(192, 192, 192)
		elseif i == 3 then
			Color = Color3.fromRGB(205, 127, 50)
		end
		
		local Item = Sample:Clone()
		Item.Name = Username
		Item.LayoutOrder = i
		Item.Values.Number.TextColor3 = Color
		Item.Values.Number.Text = "#"..i
		Item.Values.Username.Text = Username
		Item.Values.Value.Text = Value
		Item.Parent = ItemsFrame
	end
end
 local player = game.Players.LocalPlayer
while true do
	for i, v in pairs(game.Players:GetPlayers()) do
		local Stats = v.leaderstats:WaitForChild(StatsName).Value
		if Stats then
			pcall(function()
				DataStore:UpdateAsync(v.UserId, function(Value)
					return tonumber(Stats)
				end)
			end)
		end
	end
	
	for i, v in pairs(ItemsFrame:GetChildren()) do
		if v:IsA("ImageLabel") then
			v:Destroy()
		end
	end
	
	GetItems()
	
	wait()
	SurfaceGui.Heading.Text = StatsName .. " Leaderboard"
	List.ListContent.GuideTopBar.Value.Text = StatsName
	List.CanvasSize = UDim2.new(0, 0, 0, ItemsFrame.UIListLayout.AbsoluteContentSize.Y + 35)
	wait(UpdateEvery)
end
1 Like

You are looping through all of the players, and it is probably making a bunch of requests super quickly. I’d recommend using DataStore2 as it not only doesn’t have this issue, it also doesn’t have any reports of data loss.

the Title means that you are too fast with datastore requests

You’re likely reaching the DataStore requests limit for your game, you can check them out here:

Under the limits section.

Whenever you make a request, you can use return to assign the returned value to a variable, then you can check if this warning message appeared, if it did you could store the request inside a table & attempt to redo the request at some later time.

maybe add waits in between sending datastore requests.

also try only using it when really needed. like a accomplishment or cash going up, etc.

like don’t run getasync every second only when you to.