How would I be able to send less SetAsync requests?

Okay, so I’m having a problem with trying to send less SetAsync requests. Any help would be appreciated. Here is my error, and here is my datastore script.

You should only be writing to your datastore in the Player.PlayerRemoving event and game.BindToClose method and make sure to use pcall so that you can mitigate throttling and crashes. You might want to automatically save everyone’s data every few minutes just to be safe but you should not be writing to the datastore whenever a player’s leaderstats change.

Also, you’re connecting events to functions within other events which is a very bad practice and can cause memory leaks and explains why you’re writing to your datastore so frequently.

I recommend reading up on the saving player data article to learn more about better datastore practices.

3 Likes

Thanks for the advice! Now my datastore works. I’ll definitely look at the data article you linked so I can learn a lot more about datastores.