Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is the datastore telling me to send fewer requests?

Hi, I made a simple datastore script.

local DSS = game:GetService("DataStoreService")
local SFKDSS = DSS:GetDataStore("SFKDSS")
local SFDDSS = DSS:GetDataStore("SFDDSS")

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = player:WaitForChild("leaderstats")
	local Kills = leaderstats:WaitForChild("Kills")
	local Deaths = leaderstats:WaitForChild("Deaths")
	
	Kills.Value = SFKDSS:GetAsync(player.UserId, Kills.Value)
	Deaths.Value = SFDDSS:GetAsync(player.UserId, Deaths.Value)
end)

game.Players.PlayerRemoving:Connect(function(player)
	local leaderstats = player:WaitForChild("leaderstats")
	local Kills = leaderstats:WaitForChild("Kills")
	local Deaths = leaderstats:WaitForChild("Deaths")

	SFKDSS:SetAsync(player.UserId, Kills.Value)
	SFDDSS:SetAsync(player.UserId, Deaths.Value)
end)

game:BindToClose(function()
	for _, player in pairs(game.Players:GetPlayers()) do
		local leaderstats = player:WaitForChild("leaderstats")
		local Kills = leaderstats:WaitForChild("Kills")
		local Deaths = leaderstats:WaitForChild("Deaths")
		
		SFKDSS:SetAsync(player.UserId, Kills.Value)
		SFDDSS:SetAsync(player.UserId, Deaths.Value)
	end
end)

But when I leave the game in Studio, I get this error

22:10:53.883 DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 461604490

I'm not sure why, someone please explain and present a solution. Thanks!

1 answer

✓ Accepted answer

You are using 2 data stores. Consolidate your data in "SFDDSS" and "SFKDSS" into one larger table. The reason roblox is doing this is because you are sending too many data store requests. If you want to send fewer requests, use less data stores, simple.

1 comment

0

Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.