The for loop in this code prints the same set of items from the workspace even when different items are added or when the items are removed.

The code takes all of the parts attached to the handle and all of the parts attached to those and so on and puts them under the tool, this only happens with parts initially attached and not to parts attached after the game has loaded.

--on click: check all parts
--check if parts are anchored
--check if part is locked
--check if part is welded to handle either directly or remoteley
--if all is true put it under the tool
local Tool = script.Parent
local Handle = script.Parent.Handle

function CheckWelded(part)

	for _,i in pairs(game.Workspace:GetChildren())do
		if i.ClassName == "Part" then
			print("part")
			if i.Anchored == false then
				print("anchor")
				if i.Locked == false then
					print("lock")
					if i:FindFirstChild("Weld") then
						print ("weld?")
						print (i.Weld.Part1)
						if i.Weld.Part1 == part then
							print ("welded")
							i.Parent = script.Parent
						CheckWelded(i)
						end
					end
					end
					end
		end
	end
end

Handle.ClickDetector.MouseClick:Connect(function()
	CheckWelded(script.Parent.Handle)
end)