Plot Loading System Help

Hello! I’m RazorBladedino117, a scripter! I’ve developed a plot loading system, that mostly works, except for one bug. It saves the plot, and does receive the information, and mostly is accurate in it’s loading, however, whenever I save parts on a certain plot, which is oriented in a certain way, it doesn’t orient itself the same way in a different plot. It also does sometimes move around the objects. Thanks for all your help!

	for index, InstanceName in pairs(InstanceInfo) do
		print(InstanceName)
		local Entity = Instance.new("Part")
		Entity.Name = InstanceName
			
		--[ Convert to Local Formant ]--	
			
		--> Handle CFrame
		local CFrameComponenets = {}
		for x in string.gmatch(InstanceCFrameInfo[index], "[^%s,]+") do
			CFrameComponenets[#CFrameComponenets + 1] = tonumber(x)
		end
			
		Entity.CFrame = CFrame.new(unpack(CFrameComponenets)) * Canvas.CFrame CFrame.Angles(math.rad(Canvas.Orientation.X), math.rad(Canvas.Orientation.Y)math.rad(Canvas.Orientation.Z))
			
		--> Handle Size
		local SizeComponenets = {}
		for x in string.gmatch(InstanceSizeInfo[index], "[^,]+") do
			SizeComponenets[#SizeComponenets + 1] = tonumber(x)
		end
				
		Entity.Size = Vector3.new(unpack(SizeComponenets))
			
		--> Handle Color
		local ColorComponenets = {}
		for x in string.gmatch(InstanceColorInfo[index], "[^%s,]+") do
			ColorComponenets[#ColorComponenets + 1] = tonumber(x)
		end
			
		Entity.Color = Color3.new(unpack(ColorComponenets))
			
--> Handle Material
--Entity.Material = InstanceMaterialInfo[index]
				
Entity.Parent = Canvas.PlotObjects
Entity.Anchored = true

This is the actual loading part of the script. It also does load the correct part location, and even when it does “move” the objects, they all move in the same way, so if I build a building on one plot, left, rejoint and loaded it to a new plot, and they moved, they would still look like a building, but in a different location. When it rotates however, they all rotate on a local axis, and then it just looks like a mess of blocks. Thanks once again, for all your help!

Hello! It’s been about 3 days, if anyone could help?

Perhaps this could work?

-- When saving
local canvasCF = Canvas.CFrame:inverse()
local entityCF = canvasCF * Entity.CFrame -- save this CFrame to the entity

-- When loading
Entity.CFrame = -- the entity's saved CFrame

The only problem is that there are multiple plots, so if I load that CFrame, it will only load relative to the original plot it was saved to.

Have you tried testing it?

(30 chars)

You need to save the CFrame relative to the canvas / plot

--Saving
local objectSpaceCFrame = Plot.CFrame:ToObjectSpace(Part.CFrame)

--Loading
local worldSpaceCFrame =  Plot.CFrame:ToWorldSpace(objectSpaceCFrame)
Part.CFrame = worldSpaceCFrame 
3 Likes

This helped a lot! Thanks!

Sorry 30 Characters