function weld(L,A,g)local E,m={}local function r(L)for L,A in pairs(L:GetChildren())do if A:IsA("\066\097\115\101\080\097\114\116")then if m then local L=Instance.new("\087\101\108\100")L.Name="\087\101\108\100"L.Part0,L.Part1=m,A L.C0=m.CFrame:inverse()L.C1=A.CFrame:inverse()L.Parent=m end m=A table.insert(E,A)end r(A)end end r(L)for L,E in pairs(E)do E.Anchored=A E.CanCollide=g end end weld(script.Parent,true,false)print("\068\079\110\101")
-- its best to anchor while welding, and then unanchor when finished
function weld(modelgroup, anchored, cancollide)
	local parts, last = {}
	local function scan(parent)
		for _, v in pairs(parent:GetChildren()) do
			if v:IsA("BasePart") then
				if last then
					local w = Instance.new("Weld")
					w.Name = "Weld"
					w.Part0, w.Part1 = last, v
					w.C0 = last.CFrame:inverse()
					w.C1 = v.CFrame:inverse()
					w.Parent = last
				end
				last = v
				table.insert(parts, v)
			end
			scan(v)
		end
	end
	scan(modelgroup)
	for _, v in pairs(parts) do
		v.Anchored = anchored
		v.CanCollide = cancollide
	end
end

weld(script.Parent, true, false)
print("DOne")
