DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 1135513645

I keep on getting this error even though when I disable all my DataStore scripts it still pops up.
I want to figure out which script its coming from and how to fix it

Heres my two Data Store Scripts

local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
game.Players.PlayerAdded:Connect(function(plr)
	wait()
	local plrkey = "id_"..plr.userId
	local save1 = plr.leaderstats["💸"]
	local save2 = plr.leaderstats["📈"]
	local save3 = plr["🥚"]
	local save4 = plr["🔼"]
	local save5 = plr["🔼📈"]
	
	local GetSaved = ds:GetAsync(plrkey)
	if GetSaved then
		save1.Value = GetSaved[1]
		save2.Value = GetSaved[2]
		save3.Value = GetSaved[3]
		save4.Value = GetSaved[4]
		save5.Value = GetSaved[5]
	else
		local NumberForSaving = {save1.Value, save2.Value, save3.Value, save4.Value, save5}
		ds:GetAsync(plrkey, NumberForSaving)
	end
end)

game.Players.PlayerRemoving:Connect(function(plr)
	ds:SetAsync("id_"..plr.userId, {plr.leaderstats["💸"].Value, plr.leaderstats["📈"].Value, plr["🥚"].Value, plr["🔼"].Value, plr["🔼📈"].Value})
end)
--[[
	@author TwinPlayzDev_YT
	@since 8/1/2021
	@credit HowToRoblox(https://youtu.be/Be9nWHLdaQU)
	This script will handles the daily rewards!
	
	THIS CODE IS FREE TO USE TO ALL
	
	youtube.com/c/TwinPlayz_YT
--]]

-- [ SERVICES ] --

local dss = game:GetService("DataStoreService")
local dailyRewardDS = dss:GetDataStore("DailyRewards")
local ReplicatedStorage = game:GetService('ReplicatedStorage')

-- [ LOCALS ] --

local rewardsForStreak = 
{
	[1] = 200,
	[2] = 250,
	[3] = 300,
	[4] = 350,
	[5] = 400,
	[6] = 500,
	[7] = 750,
}

local Notification = ReplicatedStorage:WaitForChild("NotificationEvent")

-- [ FUNCTIONS ] --

local function toHMS(s)
	return ("%02i:%02i:%02i"):format(s/60^2, s/60%60, s%60)
end

game.Players.PlayerAdded:Connect(function(plr) -- When player joins game.
	
	workspace.RedeemRewards.Touched:Connect(function(part)
		if part.Parent.Name == plr.Name then
			if part.Parent:FindFirstChild("Humanoid") then
				
				
				local success, dailyRewardInfo = pcall(function()
					return dailyRewardDS:GetAsync(plr.UserId .. "-DailyRewards") -- Getting Players DataSTore
				end)

				if type(dailyRewardInfo) ~= "table" then dailyRewardInfo = {nil, nil, nil} end

				local cash = plr.leaderstats["💸"] -- THIS IS YOUR CURRENCY HERE

				local lastOnline = dailyRewardInfo[2]
				local currentTime = os.time() -- Getting Current Time

				local timeDifference

				if lastOnline then	
					timeDifference = currentTime - lastOnline
				end
				

				if not timeDifference or timeDifference >= 24*60*60 then

					local streak = dailyRewardInfo[3] or 1
					local reward = rewardsForStreak[streak]

					cash.Value = cash.Value + reward -- Adding The Reward.

					--Notification:FireAllClients( "DAILY REWARD SYSTEM : ", plr.Name.. " has just claimed their daily reward!" ) -- Notifying Clients.

					local streak = streak + 1
					if streak > 7 then streak = 1 end

					local success, errormsg = pcall(function()

						dailyRewardDS:SetAsync(plr.UserId .. "-DailyRewards", {cash.Value, os.time(), streak})
					end)

				elseif timeDifference then

					wait((24*60*60) - timeDifference)
					

					if game.Players:FindFirstChild(plr) then

						local streak = dailyRewardInfo[3] or 1
						local reward = rewardsForStreak[streak]

						cash.Value = cash.Value + reward -- Adding The Reward.

						Notification:FireAllClients( "DAILY REWARD SYSTEM : ", plr.Name.. " has just claimed their daily reward!" ) -- Notifying Clients.

						local streak = streak + 1
						if streak > 7 then streak = 1 end

						pcall(function()
							dailyRewardDS:SetAsync(plr.UserId .. "-DailyRewards", {cash.Value, os.time(), streak})
						end)

					end
				end
			end
		end
	end)
	
	while wait(1) do
		
		local success, dailyRewardInfo = pcall(function()
			return dailyRewardDS:GetAsync(plr.UserId .. "-DailyRewards") -- Getting Players DataSTore
		end)

		if type(dailyRewardInfo) ~= "table" then dailyRewardInfo = {nil, nil, nil} end

		local cash = plr.leaderstats["💸"] -- THIS IS YOUR CURRENCY HERE

		local lastOnline = dailyRewardInfo[2]
		local currentTime = os.time() -- Getting Current Time

		local timeDifference

		if lastOnline then	
			timeDifference = currentTime - lastOnline
		end
		
		workspace.DailyCoins.Transparency = 1

		workspace.dailytext.SurfaceGui.TextLabel.Text = toHMS((24*60*60) - timeDifference)
		
		if not timeDifference or timeDifference >= 24*60*60 then
			workspace.dailytext.SurfaceGui.TextLabel.Text = "Available Now!"
			workspace.DailyCoins.Transparency = 0
			workspace.Chest.Top.Position = Vector3.new(-28.046, 12.228, -2.075)
			workspace.Chest.Top.Orientation = Vector3.new(-50.002, 89.999, -180)
		end
	end
end)

Thanks

You need to stop sending so many requests.

1 Like

This is normal inside of studio. This usually happens to me as well, you can look in the console and see the requests going up in studio but not in-game.

It is pretty normal for this to happen, since it is a warning, the script will continue to run. I still would recommend you look into optimizing your code.

and how would i do that? i dont know how

This is horrible. This will spam a :GetAsync request once a second. This is likely using up all of your requests.

The code for daily rewards is extremely inefficient. It also sends a :GetAsync request if the user touches the part. Try using less calls or switching to a more efficient script.

Your saving script is fine, however, I’d use :UpdateAsync to avoid possible data loss. This is a useful topic on why you shouldn’t use SetAsync for data saving.

1 Like