Saving/Loading SolidModels (Unions) with Data Store Service

Just like Bloxburg did
When in house edit mode, you can clearly put ROUNED windows to the walls
That is impossible without csg opperation.

Now i know that it is possible to do solid modelling live in game with code…
but how do you save that into datastore and reload it later?

How do you take an union and make it into savable data table?

I would really love to know the answer or maybe some hints about this problem

1 Like

I think the simplest way to do it is just to separate the wall back into its components and save those. So if you had a wall and you subtracted a cylinder from it to create the rounded space for the window, you would save the cylinder’s position relative to the wall in the datastore and just subtract the cylinder again when you rebuild the wall.

The other way of doing this would probably be to add parts of the wall to the rounded window so that it is rectangular again, and just section out the wall like you would a normal rectangular window. That would definitely be much more cpu friendly than live-unioning the parts together every time the player joins and their data loads. The only problem would be having to copy over any properties the wall has to the window’s walls, which couldn’t be that hard with a more object-oriented approach.

This is also exactly what i first thought of doing, although there are some minor exceptions…
Say you put a cylinder window to the wall and saved it the way you have told so.
But with that way, i am only able tosave the position and rotation and maybe the size of the objects to datastore…how would i actually make the instances to the csg opperation?

Please let me know if you understood what i mean

1 Like

I think this is what you mean


And the actuall wall is 4 parts not 1, right?
(Yeah i glitched the game and actually saw that he did not use any csg at first to save/load via datastore)

1 Like

#4: That is indeed what I mean.

#3: You could save the relative CFrame of the cylinder to the wall so that you can load the same relative position later.

You would be saving relativeCFrame here:

local relativeCFrame = Wall.CFrame:Inverse() * Cylinder.CFrame

And loading the CFrame for newCylinder here:

newCylinder.CFrame = Wall.CFrame * relativeCFrame

Here is what i succeeded so far:

https://gyazo.com/7691fe37d8b97db0a9bf50f21e2e6008

https://gyazo.com/72dfa66c162d5a4a77cde892ddcea929
(As you can see though in second gif, there is a slight problem whiletrying to break down the wall into pieces when there is an object there too)

1 Like