Disconnect not working when it is inside of the function?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want the function to disconnect
  2. What is the issue? Include screenshots / videos if possible!
    function not disconnecting
--     
 local textchatservice = game:GetService('TextChatService')

local groupservice = game:GetService("GroupService")

local localplayer  = game:GetService("Players").LocalPlayer
local groupid = 16513197

local namemod = require(game:GetService('ReplicatedStorage'):WaitForChild("sidenamemodule"))     
local correctexample = "<font color='#1786fc'>[Scripter]</font> "


local event = game:GetService("ReplicatedStorage"):WaitForChild("events"):WaitForChild("megaphoneevent")

local newco = coroutine.create(function()
	
	
	local  disable  = nil
	
	local megaphone:Tool =	localplayer:FindFirstChild("Backpack"):FindFirstChild("megaphone")
	disable = function()
		print("equipped megaphone")
		
		megaphone.Unequipped:Connect(function()

			print("uneqpped from inside")
			disable:Disconnect() -- not disconnecting ?
			
		end)
		textchatservice.OnIncomingMessage = function(message:TextChatMessage)
			local properties = 	namemod.grouprole(message,localplayer,groupid)
			local msg = properties[1].Text
			local propertiesinstance = properties[1]	
			local prefix = "/a"
			local newmsg = msg:split(' ')
			local arg1 = newmsg[1]
			local arg2 = newmsg[2] 
			
			if arg1 == prefix and string.match(arg2,".") then

				message.Status = Enum.TextChatMessageStatus.InvalidTextChannelPermissions

				event:FireServer(arg2)

			end

			return properties[1]
		end
	
	end
	print("fired corutine")
	megaphone.Equipped:Connect(disable)

end)
 localplayer:WaitForChild("Backpack").ChildAdded:Connect(function(child)
	print(child.Name == " this is megaphone from childaddedavent")
	if child.Name == "megaphone" then

		print("found megaphone")
		coroutine.resume(newco)
	
	
	end


end)


your trying to disconnect a normal function which I dont think is possible. If you want unequipped and textchatservice to work one time only then I suggest making it run only once. You will need to organise your scripts to how you like to set it up. For example separating “TextChatService” from the tool equips which I see is only for one tool.