DataStore request issue help

Hello everyone,

Here is my problem: when a player leaves my game and finds himself alone on the server, his data is saved twice in a row. Once with “PlayerRemoving” and again with “Game: BindToClose”.

I then get the message “The DataStore request has been added to the queue” and the player cannot save their data.

If anyone has a solution to this problem I thank them in advance

image

image

The message just says the data is being saved, but is in a queue because you’re making too many requests at once. It doesn’t mean the data wasn’t saved.

but if the game shutdown, how the data can be save after ?

BindToClose prevents the server from shutting down until the code in BindToClose has finished running (it waits up to 30 seconds), so the server did not shut down before the data was saved, BindToClose prevented that from happening, because :SetAsync waits until the data actually saves.

1 Like

Add this as the first line in your game:BindToClose function

if game:GetService("RunService"):IsStudio() then return end

(this will prevent data from saving when the server shuts down in studio)

In studio, the data will save twice:

  1. When the player leaves
  2. When the server shutsdown

This is why it throws that warning.

1 Like