Best way to make a DataStore?

What is the best way to make a DataStore currently?
How do you save the data or pull the data?
I’ve made very basic ones but I don’t know if they are the best or the worst.

Which is faster?

4 Likes

I’d recommend taking a look at AlvinBlox’s tutorials on Data Store he explains a lot in it and it would help you a lot it helped me learn how to use data store as well.

Here’s the video

If you’d like to try DataStore2 you can find a tutorial about that also here too (It can be used as a back up if DataStore is down.)

The tutorial can be found here:

Here is a couple of things you can find for DataStore2:
Dev Forum Post
Module

5 Likes

Alright, thank you very much I will watch that now!

If this helped you can mark it as a solution so others know :slight_smile:

1 Like

You can also use Data Store 2. Alvin Blox also did a tutorial on this. Here is the video.

1 Like

Alright, I want to see other people’s perspective on DataStores as well.

1 Like

You can save your data as a table using DataStore2 as well, heres a tutorial on how to do that actually:

2 Likes

There are many different ways to save data, I’ll be adding one that I’ll be using for my upcoming games (note: they will be on the less popular size)

Method (mines):

  • Load data on player join
    • (wrap in pcall, retry until it loads)
  • Save data on player purchase
    • (wrap in pcall, retry until it saves)
      • (if unsuccessful, send discord webhook with purchase details)
  • Save data on player leave
    • (wrap in pcall, retry until it saves)
      • (if unsuccessful, send discord webhook with the player’s current data)

Method (berezaa’s):

  • Load data on player join
    • (if there was previous data, sort the ordered Datastore and put it as key for the player’s Datastore)
    • (wrap in pcall, if not success keep retrying)
    • (if data is nil, return default value)
  • Save on player leave
    • (store timestamps in an ordered Datastore)
    • (store data on a regular Datastore)

Method (common solution):

  • Load on player join
    • (wrap in pcall, catch errors)
  • Save on player leave
    • (wrap in pcall, retry until saved correctly)
  • Save on bind to close
    • (wrap in pcall, take advantage of exactly thirty seconds)

I would recommend DataStore-2 though, I’ve used it and it’s a much more effective solution than regular datastores.

11 Likes

One thing to note about that is that you shouldn’t use Discord as an error logging place.
You can instead try to use Sentry: Sentry - RoStrap

3 Likes

I won’t be just error logging?

I’ll have to revert the player’s unsaved values manually if possible and I’d rather not use a slow api that does the same thing as discord webhooks

1 Like

If something happens with your code, or roblox, that causes your datastore or all datastores to temporarily break, using discord webhooks may lead to moderation against your account (excessive posting in short time period? I’m unfamiliar with discord moderation)

Also, it’s “berezaa” not “berezza”. :slight_smile:

2 Likes

Thanks for that name correction.

Also no discord’s webhooks work like datastores, if they’re sent too much during a certain period then they’ll be put in queue. They shouldn’t be queued though because Datastore failures don’t happen that frequently and my games aren’t too popular.

For example, 30-40 players daily?

Just for future viewers, discord webhooks doesn’t work like that, if u exceed the limit u can get that port and IP blacklisted, they are not putted in queue, please avoid using discord as logging service, because it is not. ‘There is a big difference sending roblox errors to discord, than sending it to a logging service and then send to discord when a new error is detected’, these last are words from a discord moderator. Still if not reaching even near the 30/minute limit, please do not use discord, that goes against discord ToS, you can use a free sentry account for that low volume, happy new year to everyone.