local b={}table.insert(b,mainPart)function Weld(H,J)weld=Instance.new("\087\101\108\100")weld.Part0=H weld.Part1=J local Y=CFrame.new(H.Position)weld.C0=H.CFrame:inverse()*Y weld.C1=J.CFrame:inverse()*Y weld.Parent=H table.insert(b,J)end function WeldRec(b)local H=b:GetChildren()for b,H in pairs(H)do if H:IsA("\077\101\115\104\080\097\114\116")then Weld(mainPart,H)end WeldRec(H)end end WeldRec(P)
----- NO EDITING BELOW -----
local weldedParts = {}
table.insert(weldedParts, mainPart)

function Weld(x, y)
	weld = Instance.new("Weld")
	weld.Part0 = x
	weld.Part1 = y
	local CJ = CFrame.new(x.Position)
	weld.C0 = x.CFrame:inverse() * CJ
	weld.C1 = y.CFrame:inverse() * CJ
	weld.Parent = x
	table.insert(weldedParts, y)
end

function WeldRec(instance)
	local childs = instance:GetChildren()
	for _, v in pairs(childs) do
		if v:IsA("MeshPart") then
			Weld(mainPart, v)
		end
		WeldRec(v)
	end
end

WeldRec(P)
