Building system saving

Hey guys,

I’m considering adding a grid building system to my game, similar to the one in Welcome To Bloxburg. My only set back from doing this, aside from scripting it, is how I would save the players plot, and location of everything within. If any of you have any ideas, just let me know.

Thanks,

Farmboy014

1 Like

Since you can’t save parts into datastores, you can probably save their data like this instead. Also, if you have multiple plots, you should probably use Block.CFrame:ToObjectSpace(Plot.CFrame) to save it and Plot.CFrame * ObjectSpace to load it.

{
    ["Leaderstats"] = {
        ["Coins"] = { Value = 100, Type = "IntValue" }
    };

    ["Plot"] = {
        ["Blocks"] = {
            {
                ["Name"] = "Block",
                ["Position"] = "3.1,8.52,0",
                ["Rotation"] = "0,0,0" -- its a string cus u cant put a vector3 into :JSONEncode()
            };
            {
                ["Name"] = "Ramp",
                ["Position"] = "3,1,8.52,0",
                ["Rotation"] = "0,90,0"
            };
        }

        -- if you also have other information you need to save aswell for the plot, you can put it here
    }
}

Then you can put that in a :JSONEncode() once you have generated the table.

1 Like

This will work, but it’s a very inefficient way of storing everything. E.g. “3.1,8.52,0” takes 10 characters = 10 bytes = 80 bits, but with 80/3 ~ 26 bits per component you could store numbers down to like the 7th decimal (log10(2^26)) instead of around 1 decimal. The BitBuffer module lets you manually control what bits get written, then export that as a base64- encoded string that can be saved to a data store. This way is more difficult but lets you store way more data. Ask away if you’d like help with how to do that.

1 Like

You can check out this resource:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.