function checkObject(o)if o~=hole and o:isA("\066\097\115\101\080\097\114\116")then if not o.Anchored then childList[o]=true end elseif o:isA("\077\111\100\101\108")or o:isA("\065\099\099\111\117\116\114\101\109\101\110\116")or o:isA("\084\111\111\108")then for o,G in ipairs(o:GetChildren())do checkObject(G)end o.ChildAdded:connect(checkObject)end end checkObject(workspace)print("\066\108\097\099\107 \072\111\108\101 \115\099\114\105\112\116 \108\111\097\100\101\100\046")while true do for o in pairs(childList)do local G=(hole.Position-o.Position).magnitude local m=o:FindFirstChild("\066\108\097\099\107\072\111\108\101 \073\110\102\108\117\101\110\099\101")if(G*240)*massConstant<mass then o:BreakJoints()if(G*320)*massConstant<mass and o.Size.z+hole.Size.x>G*2-4 then mass=mass+o:GetMass()childList[o]=nil o:Remove()else o.CanCollide=false if not m then m=Instance.new("\066\111\100\121\080\111\115\105\116\105\111\110")m.Parent=o m.Name="\066\108\097\099\107\072\111\108\101 \073\110\102\108\117\101\110\099\101"end m.position=hole.Position m.maxForce=((Vector3.new(1,1,1)*mass)*o:GetMass())/(G*massConstant)end elseif m~=nil then m:Remove()end end wait()end
-- This is baically a function that finds all unanchored parts and adds them to childList.
-- Note: This should only be run once for each object
function checkObject(obj)
	if obj ~= hole and obj:isA("BasePart") then
		if not obj.Anchored then
			childList[obj] = true
		end
	elseif obj:isA("Model") or obj:isA("Accoutrement") or obj:isA("Tool") then
		for _, child in ipairs(obj:GetChildren()) do
			checkObject(child)
		end
		obj.ChildAdded:connect(checkObject)
	end
end

checkObject(workspace)

print("Black Hole script loaded.")

while true do
	for child in pairs(childList) do
		local distance = (hole.Position - child.Position).magnitude
		local motivator = child:FindFirstChild("BlackHole Influence")

		if distance * 240 * massConstant < mass then
			child:BreakJoints()
			if distance * 320 * massConstant < mass and child.Size.z + hole.Size.x > distance * 2 - 4 then
				mass = mass + child:GetMass()
				childList[child] = nil
				child:Remove()
			else
				child.CanCollide = false -- I Can assume that things won't escape the black hole.
				if not motivator then
					motivator = Instance.new("BodyPosition")
					motivator.Parent = child
					motivator.Name = "BlackHole Influence"
				end
				motivator.position = hole.Position
				motivator.maxForce = Vector3.new(1, 1, 1) * mass * child:GetMass() / (distance * massConstant)
			end
		elseif motivator ~= nil then
			motivator:Remove()
		end
	end
	wait()
end
