There is a list of servers that the player can access through the menu. Each server has player buildings that need to be saved even after the server is closed, for example, after a restart.
What’s the problem?
I know how to save data using DataStore, but I don’t know how to properly save all buildings and data about them, all items in vaults, etc.
How do I save this amount of data correctly? So that after restarting the server, everything remains in its place
For this sort of large data storage, you’re going to need to use dictionaries. For example, you’re data could look something like this.
local buildings = {
["Parts"] = {
["Part"] = {
["Position"] = Vector3.new(),
["Color"] = BrickColor.new(),
["Material"] = Enum.Material
}
["Part"] = {
["Position"] = Vector3.new(),
["Color"] = BrickColor.new(),
["Material"] = Enum.Material
}
},
["Items"] = {
["Sword"] = {
["Position"] = Vector3.new()
}
}-- this could go on and on
}
Once you’ve loaded all the data into a huge dictionary like above. You can simply save the dictionary and call it a day. 1 data store, 1 invoke, and 1 dictionary.
Side note
For a huge piece of data like this, I would highly recommend making the player manually save, like many building games do. You don’t want to be trying to save an enormous piece of data right as the player is closing out. And certainly not in an autosave