Hi. So I am making a building game but I ran into an issue. So every player has a “world” they can create and join and build in.
Currently the game saves it all to one datastore key, but when I checked out the size for a small cafe it’s approaching 210k (the limit is 260k) characters. Not good at all.
Does anyone have an idea (I don’t need code) how I can fix this? I need to split them up into different keys but I don’t know the best way to do so is.
I thought of maybe saving each block to it’s own key, but then how would I generate the key? Maybe based on the block position? How would I keep track of all the blocks and their keys, or are there better ways of doing it?
im using datastore2
sorry if it makes an error, i dont use auto fill
local ds2 = require(path.to.datastore2)
ds2.Combine('stuff', 'build')
function SaveModel(player, model)
local stuff_data = {}
for index, object in next, model:GetChildren() do
stuff_data[#stuff_data+1] = {Pos = {X = object.Position.X, Y = object.Position.Y, Z = object.Position.Z}, Size = {X = object.Size.X, Y = object.Size.Y, Z = object.Size.Z}}
end
local Data = ds2('build', player)
Data:Set(stuff_data)
local s,m = pcall(function()
Data:Save()
end
if not s then
Data:SaveAsync()
end
end