-- A recursive function (google it) which traverses all parts in a model to weld them.

function WeldAll(instance, mainPart, list)
	if instance:IsA("BasePart") then
		table.insert(list, CreateWeld(mainPart, instance))
	end
	for _,v in pairs(instance:GetChildren()) do	
		WeldAll(v, mainPart, list)
	end	
end
