What are good Tips for DataStore's?

Hello,

( I already know how to use DataStores)

So i am wondering,what are some good Tips for DataStoreService? Like what can be useful to know when saving data or learning about it,

For Example:

  • Prevention of Errors

  • Efficient Data Saves

  • The Use of :UpdateAsync() or :SetAsync() Debate


This is just a Question

The Topic will be closed after 7 days

If you can, Provide an Example,
Anything is appreciated,

Thanks.

How Many Clicks Can We Get?

3 Likes

When wanting to save loads of data, you could put all data inside of a table, and then you can save the table instead of having to save everything. Its way more efficient.

4 Likes

A few important things that come to mind are the following:

  • Have a value that checks if the players data is loaded, for example: A player joins, but then immediately leaves, if there isnt a value to check if their data was loaded, the data wont have the time to load, but it will save regardless because it always has enough time to save the values. To solve this have a value that is ticked to true only once the data is loaded, and is then checked by the data saving script. Another example of this is the roblox datastoreservice being down when the player joins, but not when they leave, resulting in data loss.

  • Have everything confirm that the data was returned properly, if you have modules for inventories that handle the data tables on their own, make sure you get verification from those functions that the data was loaded properly, if it wasnt, or if, persay, it errors, the main script wont tick the value that checks if the data was loaded, preventing data loss.

  • On top of the above, its good practice to use numerical ID’s for data wherever possible, instead of using string keys such as “Items”, instead of this, have a numerically keyed dictionary, and just know where everything is, it saves a lot of data for large amounts of players.

  • Just have a version history system, which is now implemented in roblox’s official datastore.

4 Likes

I’d like to add that if the value ends up not getting ticked, their playsession wont be saved, but you can also just notify the player that their data isnt saving due to an issue, instead of having all of their past data getting wiped.

3 Likes

Want to share data between Sub-places (not of other people)?

The way to do that is use global datastores.
You may have come across it when you were looking into datastores.

The way to implement it is similar to normal datastores.

local DataStoreService = game:GetService("DataStoreService")
local GlobalDatastore = DataStoreService:GetGlobalDataStore

It is (as the name suggests) global to all your games. So, when for some reason you want some saved data to not be saved across games, use the old way.
(You don’t have to do it the old way, but it may be much easier to know what data is used in those sub-places)

2 Likes

Cool!

CHAR LIMIT!!!

1 Like

Forget all these useless comments. USE PROFILE SERVICE. It’s what every modern game uses (some use DataStore2, but ProfileService is more modern). I even use it, and I’ve never had a case of data loss again. I mean again, since I was just doing :SetAsync, which often fails. Also, lots of people overcomplicated ProfileService my caching player data in a module script, when really you can just save all their data when they leave.

I know people are going to be calling me out saying I’m wrong, but trust me, it starts to happen when you get more traffic on your game. Don’t ask me why or how it happens, but it just does.

Don’t tell me I’m wrong if a game of yours doesn’t at least average 500 concurrent players.

1 Like

@RefusalMan What the Hell?

Ok i guess ill forget your useless comment

  • Not All Modern Games use this, some Still Use standard DataStoreService

  • I dont care if you use it, Who Asked?

  • It really depends on how you use :SetAsync() using it in a weird way is the result of Data Loss, Data Loss is usually rare but the way its used makes it quite common

  • I dont experience data loss so im not sure whats the deal with it

ProfileService doesnt attract players, I bet 90% of players dont even know what that is, Even so you are stupid to think that, People Play your game becauase its fun, not becauase it saves data.

1 Like

What are scenarios where ProfileService is actually better than using DataStoreService?

1 Like

Looking at profile services’ devforum page doesnt show any obvious benefits that I couldn’t code myself. Being able to understand your code and read it & not rely on someone elses backend is a pretty significant thing.

As stated in the post, any bugs you find are his bugs, not yours: When you understand the system you created you can fix your game & be back up and running very quickly, without significant data loss other than a few play sessions; If the module has an update with a bug pushed that (god forbid) causes data loss or some other issue that maybe just doesnt allow for data loading, you’ll be up and running while any game who uses ProfileService will be essentially down.

In my opinion its just significant to understand how all of the code in your game interacts & operates, which is something you dont do when using a custom module.

ps: please dont show up and call everyone elses posts useless, we’re trying our best, and thats kind of mean. : (

2 Likes

Every. It literally blocks all ways of data loss.

I mean if you want to code it yourself while there’s a free script to take, that’s on you lol. But trust me, BedWars uses it, I use it, there’s no bugs. I believe there hasn’t been a single bug reported for years, and that message he put on his post has been there for years too. But all it could take is around 5 minutes while some people want to take the hard hours of research and development of their own data store system lol.

Now tell me how it helps a beginner scripter use datastores much more easily.
Take into consideration the installation process, the requiring process, and how it is used in their scripts.
Remember that Roblox documentation doesn’t mention ProfileService.

2 Likes

Well, I don’t understand what you mean by the requiring process, but ok. But it’s basically the code the guy gives you in his post but you add in your stats instead. That easy, same saving process with the on leave thing, it’s hardly an effort to implement it. I do know there are tutorials who say to cache all their data so when they leave you don’t have to go through everything and save it, although if you use leaderstats and values for your player, then those values are basically cached too, so why double cache it?

I think part of what @TestyLike3 is saying is something similar to what I said in my previous message;

It’s important to understand the backend that other peoples modules are based on in the case that there isn’t a module or function in a module you’re using for a specific action you’re trying to execute.

It can be rare that there isn’t a module for something you’re trying to do, but in the situations where there isnt extensive documentation & easy to use modules, it’s important to understand the basic functions & api objects of the language everything you’re trying to do is based on in the end.

2 Likes

Knowing that there’s big games that uses this module, it’s trustable lol.

Just because some games trust it, doesnt mean others will

Im not going to use it as i have no issues with Standard DataStoreService

1 Like

Do you have a game that averages 500 players?

Why does this matter?

text

1 Like

Because data loss happens when your game reaches a certain amount of players, of course if you don’t set up the data store correctly. I have a game with over 500 concurrent players right now, so I understand, and you clearly don’t.