Data not being saved

@DarkDanny04 I already fixed that issue.

1 Like

I see it retrying 5 times but that seems like more than enough so you don’t need to edit it. Testing now…

@Awesom3_Eric I put in the script and leaderboards don’t show up at all.

Recopy the code because I made a typo from your old script with the “nwe”

I didn’t see any edits to that post, and I searched for “nwe” in that pasted script and found nothing.

Datastore.rbxl (18.9 KB)

Publish this to your place and try it out

Do you have two scripts running? My script only instances one folder called leaderstats.

There is no leaderboard when I play that file

Yes, it was another script, that’s why I deleted the post.

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

1 Like

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.