This is not for beginners, you need to know basic scripting or you won’t understand this tutorial
Required Basics:
- DataStore
- How to save in DataStore
- Building system ( this is not a tutorial for building system)
This is a long tutorial but you will understand how to save blocks for sure
So basically, you cannot save non UTF-8 characters, meaning you can only save UTF-8 Characters
What is UTF-8?
Its a name given to strings,tables and numbers in simple, like you can only save numbers, tables or strings in a datastore, you cannot save objects/instances
How do I make blocks save, if I cannot save objects/instances
You can, its simple, don’t panic, here is how:
For games like building system like bloxburg
You have 2 ways:
- Object-Name and Position
- Object-Properties and Position
So if you have a ton of models or meshes in game, you keep all of them in a folder, and then when you save it, you save the table, which have the name and position of all the objects
Did not understand?
See here’s how:
Make a table, like this:
local tabletosave = {
["ObjectName"] = "Car",
["Position"] = {
["x"] = 5,
["y"] = 15,
["z"] = 100
}
}
Now you have an idea maybe?
So, to save models, you can save their name and position
Later, find which model was there by using their name, and placing the model in the same position using the tabletosave["Position"]
table, its quite easy, and this is how many games who save their building blocks are made
But if your saving blocks, you can do:
local tabletosave = {
["Size"] = {
["x"] = 5,
["y"] = 15,
["z"] = 100
},
["Position"] = {
["x"] = 5,
["y"] = 15,
["z"] = 100
},
["Material"] = tostring(block.Material)
}
You can do this, where you save size of block and position of block, with material, you can also include Anchored
,Transparency
and even more properties too
Also you cannot save block.Material, which is Enum.Material.Plastic
, its not a string, so what you do is use tostring()
on the material, you get Plastic
, then you can later use Enum.Material["Material"]
there are even more ways
Make sure you save strings,numbers and tables(of numbers or strings), you can save a table of arrays or a table of dictionary in data store, this is a tutorial on how to save, but not on how to save in data store, so I am not including that topic here
How can I find whose blocks are built my player for saving them?
This is simple too, make a folder in workspace named “Blocks”, and in that a script which adds a folder with the name of player, so each time the player builds, keep the blocks.Parent
as workspace.Blocks.PlayerName
, later you can use loop to get all the parts of the folder, then save it
How to save BrickColor?
Save the value using tostring()
then you get “Really Red” as brickcolor, if its red, it gets the string, so you can save it
Now, how to keep it back? its simple
You use BrickColor.new() -- color name to keep colors
But now keep BrickColor.new(“BrickColor”) – the saved color name of your block, you get it
This is is all working, and I too made a building system game from this, don’t worry if you have any error comment below, I’ll try to answer them