Datastore Tutorial for Beginners

Great tutorial! I have learned a lot from it. Hopefully now I can have reliable datastores.

On a separate note, how would I assign a name and a key so that it can be modified with say DataStore Editor V2?

4 Likes

Oh that’s also my bad for not mentioning, in the entire script at the beginning of the topic, theres

local dataStore = DataStoreService:GetDataStore("YourDataStoreName") -- You can change the name to anything you want to

And then when you open Datastore editor

Enter you game id, and datastore name and then connect…
After that it will ask for your Key, and as i said our key in the tutorial is the players userid, so just type in the userid you want to check

And then press querry

Then you can change, modify whatever you want to!

4 Likes

Tysm! Will you update the tutorial at all to be UpdateAsync() or is that something I will have to figure out on my own?

1 Like

No need to use UpdateAsync() for now, i know some really really rare scenarios u will need the UpdateAsync() but you can stick with SetAsync() as it works perfectly fine, But yeah i will update the topic, In fact im updating it right now, in like 10 - 20 mins it will be updated!

Have a good day!

1 Like

Thank you so much! I will definitely come to you if I have any questions! :heart_decoration:

1 Like

In that document, one of the points it made was that using while wait() is normally used and makes the code messier and less readable:

Screen Shot 2020-08-20 at 10.00.15 PM

There, in that instance, I would agree, don’t use while wait. But in this case, I don’t see how the readability is any worse.

Also, another one of the points was that you didn’t get a return value of wait(). In this case, it wouldn’t matter.

Screen Shot 2020-08-20 at 10.04.35 PM Screen Shot 2020-08-20 at 10.04.51 PM

As it said, from a functionality standpoint, it’s not a problem in this situation. In the case of this datastore, there is no need for us to know how long it has actually been yielded for.

The only thing we need is for the autosave to run every two minutes, and we don’t need to know how long it actually took, we just need it to autosave about every 2 mins.

Edit: The way Roblox’s wait function currently works it would wait more about 119.999999-ish seconds, so it truly won’t affect it in any negative way.

4 Likes

This is a duplicate of a tutorial from the DevHub.

Not only that the but content isn’t in conjunction with the title as it’s is clickbait

Issues found so far:

  • Not using Pcalls for SaveAsync
  • Not retrying failed Pcalls
  • Not using Coroutines in BindToClose
  • Not using UpdateAsync
  • Not checking for available Budget before DataStore calls
  • Not adding any cool-downs to DataStore calls
  • Not using GetPlayers instead of GetChildren
  • The loop inside PlayerAdded will continue to run after the player leaves

I recommend that you do not follow this tutorial as it causes data problems

19 Likes

Oops, my bad, must’ve been a bit tired and havent seen that, my bad.

3 Likes

I’m sorry to have those issues, but using this works perfectly fine to me, if they wanna know how to use coroutines and updateAsync, that’s on them. I understand that I could’ve mentioned it. But after all this is a tutorial for begginers, I’ve removed the auto-saving as i just saw that i it makes issues, and i fixed the GetChildren, I must have been tired and didn’t see it. Anyways thanks for the reply, have a great day

3 Likes

Quick point: You should update your DataStore Editor plugin to get V3!

9 Likes

I already got this one for 150 robux and i like this datastore plugin, but sure i can change it, can you link it to me i can’t find it ;3

1 Like

It’s the same one! Go to Studio > Plugins tab, and click Manage Plugins. Then update from there.

1 Like

Oh, thanks! Have a great day. :smiley:

2 Likes

Is it possible to do this with bool values?

1 Like

Yeah, it’s possible to do with all types of values, String values, int values, bool values…

2 Likes

Sorry but your script doesnt work it doesnt have any value in the datastore to index the save.

1 Like

Never mind, It worked… Thank u so much!

2 Likes

No problem! …

1 Like

where do i put the script server script service?

1 Like

Yeah you put the script in server script service

3 Likes