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

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local DataStoreService = game:GetService("DataStoreService")
local data = DataStoreService:GetDataStore("TablePets")

local function printBudget()
	local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.SetIncrementAsync)
	print("Current set/increment budget:", budget)
end

Players.PlayerAdded:Connect(function(player)
	print(player.Name .. " joined the game!")

	Instance.new("Folder",player).Name = "Pets"
	Instance.new("Folder",player).Name = "PetsEquiped"
	local key = "Player_" .. player.UserId
	local Pets = player:WaitForChild("Pets")
	for i,v in pairs(ReplicatedStorage:WaitForChild("Pets"):GetChildren()) do
		Instance.new("IntValue",Pets).Name = tostring(v)
	end
	wait(1)
	local savedLevel
	local success, currentExperience = pcall(function()
		savedLevel = data:GetAsync(key)
		return savedLevel
	end)
	if success then
		print(currentExperience)
	end
	if savedLevel ~= nil then
		for i, data in pairs(savedLevel) do
			local pet = Pets:FindFirstChild(data[1])
			if pet then
				pet.Value = data[2]
			else
				local instance = Instance.new(data[3])
				if instance then
					instance.Name = data[1]
					instance.Value = data[2]
					instance.Parent = Pets
				end
			end
		end
	else
		local success, err = pcall(function()
			data:SetAsync(key)		
		end)
		if success then
			printBudget()
		else
			print(err)
		end
	end
end)
Players.PlayerRemoving:Connect(function(player)
	print(player.Name .. " left the game!")

	local key = "Player_" .. player.UserId
	local success, currentExperience = pcall(function()
		savedLevel = data:GetAsync(key)
		return savedLevel
	end)
	if success then
		print(currentExperience)
	end
	local Pets = player:FindFirstChild("Pets")
	if not Pets then return end
	Pets = Pets:GetChildren()
	local objData = {}
	for i, obj in pairs(Pets) do
		table.insert(objData, {obj.Name, obj.Value, obj.ClassName})
	end
	if savedLevel == nil then
		local success, err = pcall(function()
			data:SetAsync(key, objData)
		end)
		if success then
			printBudget()
		else
			print(err)
		end
	else
		local success, updatedName = pcall(function()
			data:UpdateAsync(key, function(oldValue)
				oldValue = objData
				return objData
			end)
			if success then
				print("Uppercase Name:", objData)
				printBudget()
			end
		end)
	end
end)
game:BindToClose(function()
	for i, player in pairs(Players:GetPlayers()) do
		local key = "Player_" .. player.UserId
		local success, currentExperience = pcall(function()
			savedLevel = data:GetAsync(key)
			return savedLevel
		end)
		if success then 
			print(currentExperience)
		end
		local pets = player:FindFirstChild("Pets")
		if not pets then return end
		pets = pets:GetChildren()
		local objData = {}
		for i, obj in pairs(pets) do
			table.insert(objData, {obj.Name, obj.Value, obj.ClassName})
		end
		if savedLevel == nil then
			local success, err, keyInfo = pcall(function()
				data:SetAsync(key, objData)
			end)
			if success then
				printBudget()
			else
				print(err)
			end
		else
			local success, updatedName = pcall(function()
				data:UpdateAsync(key, function(oldValue)
					oldValue = objData
					return objData
				end)
				if success then
					print("Uppercase Name:", objData)
					printBudget()
				end
			end)
		end
		wait(3)
	end
end)

Hi! This just means you are sending too many data requests and DataStoreService is having issues processing the new data. Usually nothing to worry about, but on larger games, this becomes an issue!

I’d recommend Profile Service. It’s a little tricky at first but it works REALLY well even when roblox is having issues. For example, it will not load data if roblox data stores are down. Its a useful module, you should give it a try. Hope this helps!

1 Like

This means you’re issuing too many requests to the DataStoreService. You can check its limitations here.