function weld(f,G,m)local q,r={}local function c(f)for f,G in pairs(f:GetChildren())do if G:IsA("\066\097\115\101\080\097\114\116")then if r then local f=Instance.new("\087\101\108\100")f.Name="\087\101\108\100"f.Part0,f.Part1=r,G f.C0=r.CFrame:inverse()f.C1=G.CFrame:inverse()f.Parent=r end r=G table.insert(q,G)end c(G)end end c(f)for f,q in pairs(q)do q.Anchored=G q.CanCollide=m end end weld(script.Parent,true,false)
-- 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)
