How to save parts, and the idea of Serialization

This doesn’t really relate to the topic or the concept in any way, this is just a common issue that can be trivially solved. You’re probably mistakenly passing a function inside of the table that InitProps receives, indexing it with ClassName later results with that error.

Which is why: don’t copy paste code ignorantly, at least understand it if you don’t wanna rewrite it from scratch, a basic understanding of the code I presented should be enough to help you debug that error. If you don’t know how to debug errors in general, that’s an important skill to acquire which is why I suggest trying to do so more.

You can also just use a serializer suited for public use by other people like the one @AwesomeXForLife made.

1 Like

I fixed it a while ago, and before that I just examined the code. My mistake was that I used a :, and not a .. I was a little confused at first, but atleast I have it working. Thanks!

1 Like

YOu cant serialize and save the source code of scripts due to script identity security.

If Roblox were to give developers access to the source code in scripts during runtime, the game can easily be spoofed by exploiters. Plus, you can just store the model in ServerStorage, collect the necessary data and serialize it. And to deserialize it, you can clone the model and set it’s position and parent. It’s not even hard.

1 Like

Question. If a player has a plot with several thousand parts, each with positions, orientations, and properties, will that take up too much space? Also, what is the limit?

If I recall correctly, the limit is 2MBs I think, not sure if that changed. Yes, that can be reached easily, I scattered a bunch of possible optimizations throughout the replies of this post, but you can easily figure out stuff yourself.

I believe the datastore limit is 4 MB, not 2MB. If you compress the data by getting rid of the useless data and round the position of the object, you will not reach the limit so easily.

Simply compression or data-splitting, problem solved. Either way this tutorial taught me alot