I’m having some issues with saving a model in a DataStore.
I’m getting some informations about the model and put them in an Array to save it later, but I just found out that I can’t save an array in a data store.
I also tried to transform the array to a string value, but I don’t know how to turn it back to an array after been saved. (I think that’s a stupid try)
This is the code that I’m using:
function PlotSave(Player,Plot)
local PlotToSave = {}
warn("Saving Plot...")
for i, obj in pairs(Plot.Stuff:GetChildren()) do
table.insert(PlotToSave,{
["Name"] = obj.Name,
["Type"] = obj.Type.Value,
["Transform"] = {
["x"] = obj.PrimaryPart.CFrame.X;
["y"] = obj.PrimaryPart.CFrame.Y;
["z"] = obj.PrimaryPart.CFrame.Z;
["r"] = obj.PrimaryPart.Orientation;
}
})
end
PlotsData:SetAsync(Player.UserId, PlotToSave)
warn("Plot Saved!")
The errors that I get: