Datastore request was added to queue

Player.userId is the same as Player.UserId, but the former is deprecated.

2 Likes

I changed it but its still the same warning

Here are some other threads that provide solutions to this:

Additional resources can be found on the Roblox Developer Hub

Data Store Errors and Limits

Thanks , i will check them out

1 Like

Hey man, now when i test it by playing the game it saves properly. Before i was testing it in studio. Am i supposed to test datastores in game? it saves and loads correctly too but the warning still exists in studio

I believe you can test it in either environment – if you’re playing the game from the website, you can also open up the Developer Console by clicking F9 and swapping to the Server view to see the Output there, if needed.

From my understanding, so long as the error is not excessive (such as upwards of a dozen every few seconds, around the mark that loleris, a prominent developer within the community, mentioned here), I don’t believe it’s a massive issue.

I’m not sure what changes you made to your code after reading through the other threads, so I would suggest testing it in an environment with more individuals/testing in Studio with multiple player instances via the “Test” tab, to see if the adjustments provided sufficient optimizations.

i mean it works and it saves all data is just warning me like this again
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 247406010

it saves data when i normally play the game but theres no way i can see if its warning me there since its when i leave that the warning appears

Read the warning. You are calling GetAsync too much and you are overloading the Data request limit.

isnt it SetAsync? and im only calling it 2 times, when the server shutdowns and when the player leaves

You are calling GetAsync in a repeat loop for whatever reason, if data is nil then this will repeat forever.

Is “API access in studio” (or whatever its called) enabled? If its not then success will never become true. I also suggest to add a max tries (after n failed tries just give up) and logging the error message

i changed it to this

local data 
	local success, err = pcall(function()

		data = materialDS:GetAsync(player.UserId)
	end)

	if success then 

		wood.Value = data[1] 
		steel.Value = data[2] 
		rock.Value = data[3]
		iron.Value = data[4]

	else 
		print("The player has no data!") 
	end

same warning , and the warning occurs when i leave so doesnt it have to do with saving?

Yes, API access is enabled in studio

Never mind, I read your code wrong. Success won’t return false if the player has no data, but you still shouldn’t be using a repeat loop.

I believe that your data is saving twice at the same time (on BindToClose and on PlayerRemoving) as you are the only person in the game.

1 Like

i mean its just a warning but the data saves, so i shouldnt be worried?

I really suggest that you change your code in order for this warning to not appear.

If there are too many requests in queue, some may be ignored and thus not saving/updating the data.

so i tested it with 2 more people, the warning occurs only when the server shutdowns or the last player in the server leaves which means it shutdowns

i fixed it by checking if when the player leaves the server has more than 1 player in it. Works perfectly now

Why do you need to check that? What you need to prioritize is how to make your datastore script efficient in order for the warning to not appear. Also, where did you put that check?

in player.removing, when the last player left or shutdown it made 2 requests to the datastore, it works now tho with no warnings