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

I’m new to datastores and I’m aware that if you save to a data store multiple times less than 60 seconds apart it will give this error. Whenever a player leaves my game, a save data function is ran that saves to multiple datastores. Rarely (about 1 times out of 9), it gives this error when the player leaves.

Could this part of the function be causing it?

local detailsSuccess, err = pcall(function()
		detailsStore:SetAsync("Player_" .. player.UserId, details)
	local miscSuccess, err = pcall(function()
		miscStore:SetAsync("Player_" .. player.UserId, misc)
	local statsSuccess, err = pcall(function()
		statsStore:SetAsync("Player_" .. player.UserId, playerStats)
	local xpSuccess, err = pcall(function()
		xpStore:SetAsync("Player_" .. player.UserId, xp)
	local inventorySuccess, err = pcall(function()
		inventoryStore:SetAsync("Player_" .. player.UserId, inventory)

I’m pretty sure this isn’t an error, it’s just a warning and it shouldn’t break your code. Adding on to this, the code you showed is most likely why you’re getting the warning.

I’d suggest having a single DataStore for player data and using tables.
For example:

dataStore:SetAsync("Player_" .. player.UserId, {
	details = details,
	misc = misc,
	stats = stats,
	xp = xp,
	inventory = inventory,

The reason I was worried about this warning is because it causes the player’s data from that session to not be saved at all. I just tried what you said by storing all of the player’s data in a single datastore using tables and it still works fine. I was still getting this warning, but I just found out that the multiple datastores wasn’t causing it and that this only happens when the save data function is called from the game:BindToClose function.
the “success” is from the save data function success, the “bind to close” is from the BindToClose function success

	for _, v in pairs(game:GetService("Players"):GetChildren()) do
		local success, err = pcall(function()
		if success then
			print("bind to close")
			print("bind to close failed")

Is there something wrong with the method I’m saving all players’ data when the game is shut down? This happens with just 1 player being saved by the way, so I do not think the for loop is causing it.

If you were testing your data saving system in Roblox Studio, the BindToClose callback would have been called really close to the PlayerRemoving event which would cause the player’s data to save twice in a very short matter. This shouldn’t be a problem in the main game. Unless there are too many requests to the key, it will just delay the saving of the data.

1 Like

Yes, after posting that reply I read up on a lot about BindToClose and learned that this issue would only happen in studio, and it can be prevented by using RunService:IsStudio(). However, I tested the BindToClose function in a real game by shutting down all servers and it still gives this warning, and as a result the player’s data is not saved at all.

(“left” is the playerremoving function, “bind” is the BindToClose function, “success” is the save data function success, “player left success” is the playerremoving function success)

The warning message being displayed doesn’t mean that the data hasn’t been saved, it means that the cooldown for the specified key is still active and that it will delay the saving of the data. Instead of not saving the player’s data, it should be saving it twice. If the data isn’t actually being saved, then there’s something else wrong.

1 Like