1/3/2024 0 Comments Roblox studio datastoreWhat we will do is, loop through the inputed array, and each time we check if a key corresponding with the current object’s class exists inside of tableToSave, if not create it inside of that table. We’ll have a table called tableToSave sample2, which will be the saved table, that will contain all of the saved classes, and the saved objects with their corresponding saved properties, this is pretty much the first table I mentioned at the start. This function will take an array of objects as input, and return an array sample2 of the serialized versions of the objects. Now, let’s serialize objects! I’m gonna make a function called InitProp (Init short for initiate). We’ll look into this more later, since this is the same thing that we’ll do with the Children table. One thing to point out, notice when dealing with CFrame, I’m using Serialize inside of Serialize, because as we said earlier, a serialized CFrame is made up of 4 Vector3s, so you have to serialize them as well. Meaning, if I had a part named "Bob", with Transparency set to 0.5, and Anchored to true, we would convert it into something like this: Įlse -if it's a normal property, like a string or a number, return it To keep it short, a way to store objects, is to convert them into dictionaries, where each key is a property of that object, and each value is the value of that corresponding property. Most people, with games that are supposed to have slots and stuff on them that you want to save, get stuck when doing this, although, I think finding a way to go over this is quite easy. can’t be simply saved using :SetAsync(), which makes it hard to save objects. If you played with Datastore for enough time, I think you already know that Instances such as parts and models ect. This article is the answer to the famous question “How to save objects using Datastore” and many other ways to word it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |