Reduce 'DataStore request was added to queue.'

I have a game with datastores where i save how many coins a player has, what suits, and right now also how many eggs they have found. However I keep seeing this warning in my error report:
‘DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.’
I am not getting warnings about requests being dropped, only that they are being added to a queue. (I get notified for this because I have a pcall wrapped around every setasync and getasync.)
The problem is that I am not saving or loading data too often. Data gets saved or loaded in my game on either of these things:
-player joins the game
-player leaves the game
-game closes for some reason (bindtoclose and in a coroutine.wrap)
-when a player buys a devproduct
-autosaving once every 5 minutes.

I think that these are normal moments when data should be saved right?
In my game though, people can get teleported to many other places, when the data has to be loaded and saved again.


Could this be the issue, or is there something else as to why i am sending too many requests?
And if this is the issue, how do i fix this problem? Do I send player’s data with teleportdata when they get teleported or is this not secure? Any ideas would be appreciated!

Frequent player teleportation can overwhelm data store requests. A solution is to save data only when it changes, like when a player’s coins are updated, or a new item is added to a folder.

But what about the shop, when a player buys multiple items at once? Then it would save multiple times right? wouldnt that overwhelm it as well?

You’re correct. However, it’s still a better approach compared to the repeated saving and loading that occurs during player teleportation.

Im thinking of adding a new value named ‘ValueChanged’ and a function that listens to whether any data entry is changed, and then setting ValueChanged to true when it happens. And then only saving data when this ValueChanged is set to true. what do you think of that? could that be a good solution?

That sounds like a great idea. Adding a “ValueChanged” value could optimize data saving by only saving when necessary.

1 Like

I normally do save data when

• Player joins.
• Players leaves
• Game shutdown

And not when

• Value changes
• Player buys an item (Ingame currency)

if you want, you can save data when an devproduct / gamepass is purchased

I have this as well, yet im still at the datastore limit

Try increasing autosave interval,
The request queue could fill if
Auto save initiated and then right after that a player teleports.

if you see the error when you press stop, it’s normal because you make 2 requests in a short time, btw i suggest you to use profile service

If you’ve got a BindToClose function, check if the current environment is studio. If it is, don’t save on the BindToClose, similar to what @SimoDevv said. Also, if you need to, increase your autosave interval. I’d recommend doing every 10 minutes.

1 Like