Data not being saved

Did you publish the file to a place and enable api accees?

1 Like

Maybe you made a typo. Rewriting the code will help if you can’t find it.

You need to be testing this on the actual game and not in studio. Studio usually closes too fast before listening to the PlayerRemoving event.

1 Like

Hello, there are some services that roblox offers us, one of them is datastoreservice. Data loss can occur when using the datastoreservice alone. When loading / saving data, I recommend using a data module: Save your player data with ProfileService! (DataStore Module)

Is API services Enabled? If not, test it in game.

Also the PlayerRemoved event for me does not run when I stop playtesting in studio.

Instead of doing this save what’s ever on your leader stats at a server shutdown or the player leaves so that player with there unique key would get saved.

I like auto saving every minute better, and on leaving.

server shutdown or the player leaves. Would be way better.

What if the server crashes, then it won’t be able to run the code on shutdown.

Still works.
And saves from what I’ve tested

Use BindToClose() and put a wait(n) in it .

Since I’ve experienced a lot of crashes but rarely any dataloss. Dataloss was present when I did to many requests with the same key.