Table(s) cannot be saved to data store

game.Players.PlayerRemoving:Connect(function()
	
	local PartsToSave = {}
	
	for i,v in pairs(workspace:GetChildren()) do
		if game.ReplicatedStorage.Builds:FindFirstChild(v.Name) then
			
			local PartProperties = {
				v.Shape,
				v.Position,
				v.Orientation,
				v.Size,
				v.Anchored,
				v.CanCollide
			}
			
			table.insert(PartsToSave, PartProperties)
		end
	end
	
	local Key = "builds_save"
	
	for i,v in pairs(PartsToSave) do
		print(i)
	end
	
	local success, errormesage = pcall(function()
		MyDataStore:SetAsync(Key, PartsToSave)
	end)
	
	if success then
		print("success")
	elseif errormesage then
		warn(errormesage)
	end
	
end)

I made a script for my building game which will save parts when the player leaves

Each part has it’s own table which stores the properties of the part, so I can use the table to load the part back in with the same properties

The table for each part is being stored inside of another table (called PartsToSave)

This is the error message that I’m being given:
104: Cannot store Array in data store. Data stores can only accept valid UTF-8 characters. - Server

for more context, this line here:

if game.ReplicatedStorage.Builds:FindFirstChild(v.Name) then

just determines if the part in the workspace is a part that can be saved or not

My guess is that it’s the position, orientation, and size properties preventing the save. You can’t save Vector3/CFrame to Datastore, you need to serialize them

You’re most likely trying to save a Vector3, CFrame, Color, or something of the like to a datastore. As the error message says, data store can only accept valid UTF-8 characters.

For example, you could save “0.1”, “2.4”, and “6.8” individually, but you could not save a Vector3 which contains (0.1, 2.4, 6.8).