local k={}table.insert(k,mainPart)function Weld(J,g)local b=Instance.new("\087\101\108\100")b.Part0=J b.Part1=g local I=CFrame.new(J.Position)b.C0=J.CFrame:inverse()*I b.C1=g.CFrame:inverse()*I b.Parent=J table.insert(k,g)end function WeldRec(k)local J=k:GetChildren()for k,J in pairs(J)do if J:IsA("\066\097\115\101\080\097\114\116")then Weld(mainPart,J)end WeldRec(J)end end WeldRec(P)

local weldedParts = {}
table.insert(weldedParts,mainPart)

function Weld(x, y)
	local 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("BasePart") then
			Weld(mainPart, v)
		end
		WeldRec(v)
	end	
end

WeldRec(P)