I’m trying to save, essentially, a Model’s Name and a CFrame attribute in a dictionary, the format goes like this
local _playerData = {
["Furnitures"] = {"s","d","f"}
["Plots"] = {
["testdummee"] = {-- m:getattribute("pivot")
["CFrame"] = table.pack(CFrame.new():GetComponents())
}
}
}
However it exceeds the size limit and I am unable to save dictionarities to datastores, I was thinking of using buffer but how would I approach that?
On save.
local function _serializePlots(t)
local _plots = {}
for _,v in workspace._Furnitures:GetChildren() do
if v:HasTag("_noBB") then continue end
table.insert(_plots, v)
end
for _,v in _plots do
local m = require(ServerStorage._Assets._Modules._Data.Serialize).SerializeModel(v)
table.insert(t, m)
end
table.clear(_plots)
_plots = nil
return t
end
_playerDataGreenhouse.Plots = _serializePlots({})
local setSuccess, errorMessage = pcall(function()
_playersStoreGH:SetAsync(tostring(Player.UserId), _playerDataGreenhouse)
end)
local function _serializeCFrame(M: Model)
return {M:GetAttribute("_pivot")}
end
-- This returns a {[ModelName] = ["CFrame"] = SerializedCFrame}
Serialize.SerializeModel = function(Model : Model)
return {[Model.Name] = {["CFrame"] = _serializeCFrame(Model)}}
end