Very simple error I can't solve

local Data = {
	['Name']=objects.Name,
	["Pos"] = tostring(plot.CFrame:ToObjectSpace(objects.CFrame)),
	["Color"] = {
		["R"] = objects.Color.R,
		["G"] = objects.Color.G,
		["B"] = objects.Color.B

	}
}

for i,v in pairs(Data) do
	plotdata[i] = v
end

Try This

Got more progress, I think it works, but, now when cloning the object, it says “Argument 1 missing or nil” so the name apparently probably isn’t saving.

No, after checking it does save the name, just isn’t loading.

Try changing the ‘Name’ variable to something else cause it might be interfering with your code.

Are you indexing the table by using plotdata.Name or plotdata[‘Name’]?

.Name, but also, now nothing is saving.

Don’t do .Name, whenever your referencing a dictionary use [‘Name’]

local loadedmodel = game.ReplicatedStorage.BuildableObjects:FindFirstChild(saved['Name']):Clone()

if loadedmodel then
	print(saved.Pos)

	loadedmodel.BrickColor = BrickColor.new(saved['Color'].R,saved['Color'].G,saved['Color'].B)

	loadedmodel.Parent = plotbeingviewed
	loadedmodel.CFrame =    tonumber(saved.Pos) *  plotbeingviewed.CFrame
	
end

Try This

Didn’t work, I don’t know what to do.

Maybe it just a issue with your datastore script, try using Profile Service by Loleris

game.Players.PlayerRemoving:Connect(function(player)



	local plot = game.Workspace.Plots:FindFirstChild(player.PlotOwned.Value)







	local plotdata = {

	}

	if plot then
		if game.Workspace.Plots:FindFirstChild(player.PlotOwned.Value) then
			for i, objects  in ipairs(plot:GetChildren()) do
				if objects:IsA("BasePart") and objects.Name ~= "Box" then

					local Data = {
						['Name']=objects.Name,
						["Pos"] = tostring(plot.CFrame:ToObjectSpace(objects.CFrame)),
						["Color"] = {
							["R"] = objects.Color.R,
							["G"] = objects.Color.G,
							["B"] = objects.Color.B

						}
					}

					for i,v in pairs(Data) do
						plotdata[i] = v
					end

				end
			end
		end
	end
	player.PlotOwned.Value = ""


	local id = "Player_" .. player.UserId
	local success, err = pcall(function()



		plotstore:SetAsync(id,plotdata)

	end)




	if success then
		print("saved")
	else
		print("no")
		print(err)
	end


end)

If this doesn’t work, it most likely your datastore script

Yeah didn’t work, whatever. I’ll just work on it another time.

Change your DataStore script with Loleris, Profile Service

local Data = {
	['Name']=objects.Name,
	["Pos"] = tostring(plot.CFrame:ToObjectSpace(objects.CFrame)),
	["Color"] = {
		["R"] = objects.Color.R,
		["G"] = objects.Color.G,
		["B"] = objects.Color.B

	}
}
table.insert(plotdata,Data)

Oh found the issue, didn’t realize you had multiple datas you were saving. Now when you are adding the parts loop through the plotdata first then you can index each of it.

for i,v in pairs(saved) do
	local loadedmodel = game.ReplicatedStorage.BuildableObjects:FindFirstChild(v['Name']):Clone()

	if loadedmodel then
		print(v.Pos)

		loadedmodel.BrickColor = BrickColor.new(v['Color'].R,v['Color'].G,v['Color'].B)

		loadedmodel.Parent = plotbeingviewed
		loadedmodel.CFrame =    tonumber(v.Pos) *  plotbeingviewed.CFrame

	end
end

There you go

Thanks, the data saving works perfectly, however the CFrame is still broken, we need a CFrame expert, lol.

Does the CFrame save correctly? Maybe the issue stems from how it’s being applied?
How much “off” is the CFrame? Is it a slight deviation/rotation or is it literally loading on the wrong side of the map?

Note that CFrame has some very exclusive math operations (because they’re being represented with matrices or quaternions or some other weird mathematical data structure that I’m not qualified to talk about) so if you’re not careful you’ll end up making silly mistakes, for example, cframe1 * cframe2 is NOT the same as cframe2 * cframe1

Furthermore, I’m not exactly sure why it’s doing this compound assignment; what is cube.CFrame before you try to multiply it with plot.CFrame? What and why is there a pre-set CFrame for the cube? Ideally, it should be the other way around where the object’s position is an offset of the plot, so something like

cube.CFrame = plot.CFrame * placementOffset --placementOffset being a CFrame calculated prior to saving

LoadCFrame.rbxl (33.9 KB)

local base = workspace.Plot.Base
local loadBase = workspace.LoadPlot.Base
for _, p in pairs(workspace.Plot:GetChildren()) do
	if p.Name == "Base" then continue end
	local partCFrame = base.CFrame:ToObjectSpace(p.CFrame) -- save this
	
	
	local loadPart = p:Clone()
	loadPart.CFrame = loadBase.CFrame:ToWorldSpace(partCFrame) -- load like this
	loadPart.Parent = workspace.LoadPlot
end

I tried it, now it says argument 2 missing or nil.

works fine in the rbxl file, learn to debug your stuff

I wasn’t quite able to find the solution, but I do appreciate the suggestions. I’ll work on something else.