PartFound=nil function Weld(F,B)local N=Instance.new("\087\101\108\100")N.Part0=F N.Part1=B local j=CFrame.new(F.Position)local x=F.CFrame:inverse()*j local p=B.CFrame:inverse()*j N.C0=x N.C1=p N.Parent=F end function Get(F)if F.className=="\080\097\114\116"then if script.Parent:FindFirstChild("\072\097\110\100\108\101")~=nil then Weld(script.Parent.Handle,F)else Weld(PartFound,F)end F.Anchored=false else local B=F:GetChildren()for F=1,#B,1 do Get(B[F])end end end function Finale()if script.Parent:FindFirstChild("\072\097\110\100\108\101")~=nil then Get(script.Parent)else List=script.Parent:GetChildren()for F=1,#List,1 do if List[F].ClassName=="\080\097\114\116"then PartFound=List[F]break end end Get(PartFound.Parent)end end if script.Parent.ClassName=="\084\111\111\108"then Finale()script.Parent.Equipped:connect(Finale)script.Parent.Unequipped:connect(Finale)else Finale()end


PartFound = nil

function Weld(x,y)
	local W = Instance.new("Weld")
	W.Part0 = x
	W.Part1 = y
	local CJ = CFrame.new(x.Position)
	local C0 = x.CFrame:inverse()*CJ
	local C1 = y.CFrame:inverse()*CJ
	W.C0 = C0
	W.C1 = C1
	W.Parent = x
end

function Get(A) --Get all parts
	if A.className == "Part" then
		if script.Parent:FindFirstChild("Handle") ~= nil then
			Weld(script.Parent.Handle, A) --You're a tool
		else
			Weld(PartFound, A) --Not a tool
		end
		A.Anchored = false
	else
		local C = A:GetChildren()
		for i=1, #C do
		Get(C[i])
		end
	end
end

function Finale()
	if(script.Parent:FindFirstChild("Handle")) ~= nil then -- A tool
		Get(script.Parent)
	else 																	-- Something else~!
		List = script.Parent:GetChildren()
		for i = 1, #List do
			if List[i].ClassName == "Part" then --Find First Part
				PartFound = List[i]
				break
			end
		end
		Get(PartFound.Parent)
	end
end

if script.Parent.ClassName == "Tool" then
	Finale() --In case the tool is sitting in the workspace
	script.Parent.Equipped:connect(Finale) --When you equip it
	script.Parent.Unequipped:connect(Finale) --And when you unequip it
else
	Finale() --But I'm not a tool!
end 
