local f={}table.insert(f,mainPart)function Weld(G,m)weld=Instance.new("\087\101\108\100")weld.Part0=G weld.Part1=m local q=CFrame.new(G.Position)weld.C0=G.CFrame:inverse()*q weld.C1=m.CFrame:inverse()*q weld.Parent=G table.insert(f,m)end function WeldRec(f)local G=f:GetDescendants()for f,G in pairs(G)do if G:IsA("\066\097\115\101\080\097\114\116")then Weld(mainPart,G)end WeldRec(G)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:GetDescendants()
	for _, v in pairs(childs) do
		if v:IsA("BasePart") then
			Weld(mainPart, v)
		end
		WeldRec(v)
	end
end

WeldRec(P)
