Saving Array in a DataStore

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:

1 Like

You cannot save Vectors in a DataStore, you need to save the X,Y,Z of the orientation like you did with the position.

2 Likes

ohhh, I just noticed that I was saving the whole Vector and not only the Y.
Thanks

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.