This DataStore is not safe at all.Īlright, we are halfway through this tutorial right now. → We will use BindToClose to delay the shutdown. Well, yes, but often, Studio simply shuts down too fast making it impossible for PlayerRemoving to fire. Now, you might wonder: why do I need a BindToClose? We already have a PlayerRemoving event that has a saving function connected to it! There is just something we didn’t add yet: a BindToClose. In fact, I think this is the most common one. No, we didn’t! Many scripters that are newer to DataStores face this issue. Huh? Why is that? Did we do something wrong? Now if we insert that into studio though, you will notice a problem (actually two if you don’t have API Services enabled ): it’s not saving! (btw, I will use ColdCode to screenshot the code I wrote in VSC instead of creating it here, I think that looks better) With GetAsync, you can get the data with a key that you have to pass as the first argument (arguments = the things you pass when calling a function, parameters = the things you receive inside of the function).īefore we use anything, we have to first create it. They are shared per game, so different places can access and change the same data. We will start with “ What are DataStores”.ĭataStores are “containers” that you can store data in. So just use them if you need a safe DataStore, I only made this for showing you some ideas that can be applied to DataStores. This won’t be as safe as DataStore2 or ProfileService, as both are heavily tested. Important: This won’t be as safe as DataStore2 or ProfileService Over the course of this, we will script a DataStore (that will hopefully be safe). DataStore Version 2.0 won’t be included in this tutorial either. This tutorial will teach you about regular DataStores (I won’t include OrderedDataStores, but they are pretty similar).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |