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

"DataStore request was added to queue" Error?

I created this script to save the coins that the player has already taken in a game. The script until it works, but as all coins run this same script, when the game is saved (when the player leaves the game) the following error appears: " DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key " to try to correct this error, I saved it when the player left the game, but as noted, it didn’t help does anyone have any idea how to fix this? I don't want players to lose their data script:

data = game:GetService("DataStoreService"):GetDataStore("DataStoreTest2")
local coindestroy = game:GetService("ReplicatedStorage"):WaitForChild("Slotdata"):WaitForChild("CoinDestroy")
local db = false

PlayerData = nil

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		if db == false then
		db = true	
		if PlayerData == nil then
		player = game.Players:GetPlayerFromCharacter(hit.Parent)		
		local sucess = pcall(function()
	 PlayerData = data:GetAsync(player.UserId)
	end)
	end
script.Parent.Position = Vector3.new(100,100,100)

for i,v in pairs(PlayerData[3]) do
	print(v)
	print(i)    
	end

		table.insert(PlayerData[3],"c1")
		
		
		for i,v in pairs(PlayerData[3]) do
	print(v)
	print(i)    
	end
		
		
		end
	end
	
end)





game.Players.PlayerRemoving:Connect(function(plr)
 for i,v in pairs(PlayerData[3]) do
	print(v)
	print(i)    
	if v == "c1" then
	
	local tries = 0
	
	repeat 
	
	tries = tries + 1
	local sucess = pcall(function()
	data:SetAsync(plr.UserId, PlayerData)
	end)
		if not sucess then 
	warn("Error!player data doesn't saved!")	
	wait(6.2)
	end
	if sucess then print("Salvado:Coin1!") end 
	until tries == 5 or sucess
	end
	end
	
	
end)

1 answer

Hello lytew. The error is happening because you've made too many DataStore requests. For information on errors and limits, vist the Data Store Errors and Limits page on the Roblox Developer Hub.

1 comment

0

hello @youtubemasterWOW. I already tried to search, but I couldn't find anything that would help me, so recently my last idea was to try to save the data separately, but I don't know how to do it

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