DataStore request was added to queue. DataStore2

I’m trying to load in data saved using DataStore2 but every time i get into the game the data is not loaded.

The error im receiving is: “23:00:50.225 - DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Data Store = Weapons/41956221”

This is the portion of my code that loads in the data:

	local coins = datastore2("Coins", plr)
	local EXP = datastore2("Experience", plr)
	local Levels = datastore2("Levels", plr)
	local Points = datastore2("Points", plr)
	local Defense = datastore2("Defense", plr)
	local Speed = datastore2("Speed", plr)
	local Multiplier = datastore2("Multiplier", plr)
	local Rebirths = datastore2("Rebirths", plr)
	local Gems = datastore2("Gems", plr)
	local MapsOwned = datastore2("Maps", plr)
	local WeaponsOwned = datastore2("Weapons", plr)
	local PetsOwned = datastore2("Pets", plr)
	local valfolder = valuefolder
	valfolder.Coins.Value = coins:Get(0)
	valfolder.Experience.Value = EXP:Get(1)
	valfolder.Levels.Value = Levels:Get(1)
	valfolder.Points.Value = Points:Get(0)
	valfolder.Defense.Value = Defense:Get(100)
	valfolder.Speed.Value = Speed:Get(16)
	valfolder.CoinMultiplier.Value = Multiplier:Get(1)
	valfolder.Rebirths.Value = Rebirths:Get(0)
	valfolder.Gems.Value = Gems:Get(0)
	valfolder.MapsOwned.Value = MapsOwned:Get(1)
	game.ReplicatedStorage.Remotes.LoadMap:FireClient(plr, MapsOwned:Get(1))
	for i, v in pairs(WeaponsOwned:Get({})) do
		if v ~= "Iron Sword" then
			local clone = game.ReplicatedStorage.GameItems.Weapons[v]:Clone()
			clone.Parent = weaponsfolder
	for i, v in pairs(PetsOwned:Get({})) do
		local clone = game.ReplicatedStorage.GameItems.Pets[v]:Clone()
		clone.Parent = petsfolder
1 Like

It looks like you haven’t combined your datastores. Try adding this line right after you define the last datastore.

datastore2.Combine("PlayerData", "Coins", "Experience", "Levels", "Points", "Defense", "Speed", "Multiplier", "Rebirths", "Gems", "Maps", "Weapons", "Pets")



I followed your advice, however i still have a problem. Weapons are not working, any ideas?

does it still give the same error as last time or is this a new issue?

same error as last time, it occurs only for the weapons and pets.

I think there’s a limit on how many datastores you can use. Maybe try putting some of the ones that are similar into an array?

what do you mean by that? im new to datastore 2 and datastore in general, would you mean something like this?

datastore2 = require(datastore)
local values = {
coins = 5,
points = 3
} etc..etc

Yeah, something like that should work.

i’ll give that a shot, to get the coins value for example would i do

datastore2 = require(datastore)
local values = datastore("Values", plr)
local coins = values[1]:Get(1)

no, since you’re saving it in an array it should be different

local defaultvalues = {}
defaultvalues.coins = 0
defaultvalues.exp = 0
-- etc

local playerdatastore = datastore2("PlayerData", plr)
local playerdata = playerdatastore:Get(defaultvalues)

Ohhh, understood. i’ll try it now thanks

DataStores will throttle requests if there are too many of them, that is why you are getting this issue. Try to cut down the amount of requests by doing what @azahid1 described.

I’m attempting it however, i’m a bit stuck at the moment. I’m attempting to increment a value within the table within the datastore.

Basically here’s what im trying

–Main Data Script–

local datastore2 = require(script.Parent.DataStore2)
local MainKey = "DataStoreKey"
datastore2.Combine(MainKey, "Values")

local function SetDataTable()
	local DefaultData = {
		Values = {
		["Coins"] = 0,
		["Gems"] = 0,
		["Experience"] = 0,
		["Levels"] = 1,
		["Points"] = 0,
		["Defense"] = 100,
		["Speed"] = 16,
		["Multiplier"] = 1,
		["Rebirths"] = 0,
		["Maps"] = 1,}
	return DefaultData

local UserData = datastore2(MainKey, plr):Get(SetDataTable())
local values = datastore2("Values", plr)

—enemy script—

local datastore2 = require(script.Parent.DataStore2)

local UserData = datastore2(MainKey, plr):Get(SetDataTable())
local values = datastore2("Values", plr)

userdata.Values.Experience = userdata.Values.Experience + expgain

however, this returns the error: Attempt to index field ‘Values’ a nil value.
Again i’m not good with datastores so i apologize in advance if this seems foolish.
I’m not sure what to do to fix it.

Instead of doing this, increment on the server and save when the player leaves.

I am incrementing on the server, the enemy script is a serverscript, or do i need to increment using the same script rather than increment it in a seperate (enemy) script?

I mean only update the datastore when the player leaves, and not constantly as I assume you are doing.