Datastore Tutorial for Beginners

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