-- run


local normal = cutPlane.CFrame.rightVector; 
if choppingBlock then
	pos1, size1, pos2, size2 = slicePart(choppingBlock, cutPlane.Position, normal);
	--choppingBlock.Anchored = false;
end

if (pos1 and size1 and pos2 and size2) then
	local part = choppingBlock:Clone();
	part.Size = size1;
	part.CFrame = CFrame.new(pos1);
	part.Parent = choppingBlock.Parent;
	part.Anchored = true
	part.Name = "1"

	local part = choppingBlock:Clone();
	part.Size = size2;
	part.CFrame = CFrame.new(pos2);
	part.Parent = choppingBlock.Parent;
	part.Anchored = true
	part.Name = "2"
	
	choppingBlock:Destroy();
	if script:GetAttribute("Direction") == "Left" then
		workspace["1"].Parent = workspace.Stacked
		workspace["2"].Anchored = false
		workspace["2"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Right" then
		workspace["2"].Parent = workspace.Stacked
		workspace["1"].Anchored = false
		workspace["1"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Top" then
		workspace["1"].Parent = workspace.Stacked
		workspace["2"].Anchored = false
		workspace["2"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	elseif script:GetAttribute("Direction") == "Bottom" then
		workspace["2"].Parent = workspace.Stacked
		workspace["1"].Anchored = false
		workspace["1"].Name = "Delete"
		debris:AddItem(workspace["Delete"], 60)
	end
end
