local R={}function GetConnection(C)for R,w in pairs(R)do if w==C then return true end end return false end game.Players.PlayerAdded:connect(function(C)C.CharacterAdded:connect(function(w)w.ChildAdded:connect(function(w)if w:IsA("\084\111\111\108")and not GetConnection(w)then w.Changed:connect(function(R)if w and(w.Parent~=nil and R=="\080\097\114\101\110\116")then wait(.033333333333333)local R=w:FindFirstChild("\072\097\110\100\108\101")if w.Parent==workspace then if R and(R:CanSetNetworkOwnership()and C)then R:SetNetworkOwner(C)end else if R and(R:CanSetNetworkOwnership()and C)then R:SetNetworkOwnershipAuto()end end end end)table.insert(R,w)end end)end)end)while true do wait(1)for C,w in pairs(R)do if w.Parent==nil then R[C]=nil end end end
--solves the problem of tools falling thru houses

local connectedtools = {}

function GetConnection(tool)
	for _, v in pairs(connectedtools) do
		if v == tool then
			return true
		end
	end
	return false
end

game.Players.PlayerAdded:connect(function(plr)
	plr.CharacterAdded:connect(function(char)
		char.ChildAdded:connect(function(child)
			if child:IsA("Tool") and not GetConnection(child) then
				child.Changed:connect(function(property)
					if child and child.Parent ~= nil and property == "Parent" then
						wait(1 / 30)
						local handle = child:FindFirstChild("Handle")
						if child.Parent == workspace then
							if handle and handle:CanSetNetworkOwnership() and plr then
								handle:SetNetworkOwner(plr)
							end
						else
							if handle and handle:CanSetNetworkOwnership() and plr then
								handle:SetNetworkOwnershipAuto()
							end
						end
					end
				end)
				table.insert(connectedtools, child)
			end
		end)
	end)
end)

while true do --clean table
	wait(1)
	for i, v in pairs(connectedtools) do
		if v.Parent == nil then
			connectedtools[i] = nil
		end
	end
end
