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

How do I make this DataStore request work?

local dataService = game:GetService("DataStoreService")
local allowedPlayers = dataService:GetDataStore("allowedPlayers")
local allowedListers = dataService:GetDataStore("allowedListers")
local i = 1

prefix = ";"
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "lzxus" then
		player.Chatted:Connect(function(msg, recipient)
			if not recipient then
				print(msg)
				if msg:sub(1,10) == prefix.."addLister" or msg:sub(1,10) == prefix.."addlister" then
					local Target = msg:sub(12,msg:len())
					print(Target)
					repeat
						local check, er = pcall(function()
							print("pcall 1 has been run")
							return allowedListers:GetAsync(i)
						end)
						if check then
							i = i+1
							print("adding integer")
						end
					until er
					
					local function checkSuccess()
						local success, err = pcall(function()
							allowedListers:SetAsync(i, Target)
							print("pcall 2 has been run")
						end)
						if success then
							print("Successfully Added")
						elseif err then
							repeat 
								checkSuccess()
							until success
						end
					end
					checkSuccess()
				end
			end
		end)
	end
end)

The problem I am having is that the program stops at "return allowedListers:GetAsync(i)" Error message: 13:22:17.921 - DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 1 (x2)

3 comments

0

https://developer.roblox.com/en-us/articles/Datastore-Errors | Error 305: request has exceeded the maximum queue size and Roblox is unable to process the requests at the current throughput.

0

Request Limit Per Minute For GetAsync = 60 + numPlayers × 10

0

I've found the error and fixed it

1 answer

I was able to fix my own problem by editing the code and restarting studio.

local dataService = game:GetService("DataStoreService")
local allowedPlayers = dataService:GetDataStore("allowedPlayers")
local allowedListers = dataService:GetDataStore("allowedListers")
local i = 1

prefix = ";"
game.Players.PlayerAdded:Connect(function(player)
	if player.Name == "lzxus" then
		player.Chatted:Connect(function(msg, recipient)
			if not recipient then
				print(msg)
				if msg:sub(1,10) == prefix.."addLister" or msg:sub(1,10) == prefix.."addlister" then
					local Target = msg:sub(12,msg:len())
					print(Target)
					repeat
						local check = allowedListers:GetAsync(i)
						print("it still moves on")
							wait(1)
						if check then
							i = i+1
							print("adding integer")
						end
					until not check
					
					local function checkSuccess()
						local success, err = pcall(function()
							allowedListers:SetAsync(i, Target)
							print("pcall 2 has been run")
						end)
						if success then
							print("Successfully Added")
						elseif err then
							repeat 
								checkSuccess()
							until success
						end
					end
					checkSuccess()
				end
			end
		end)
	end
end)

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