Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to Disconnect a Function?

How do I disconnect the OnClientEvent or Disable it?

local a = true

RemoteEvent.OnClientEvent:Connect(function(b)
	if a == false then
	:Disconnect(b)
end)

1 answer

✓ Accepted answer

The :Connect method returns a signal object which you can disconnect to disconnect that signal like so:

local a = true

local connection
connection = RemoteEvent.OnClientEvent:Connect(function(b)
    if a == false then
    	connection:Disconnect()
	end
end)

3 comments

0

Can i Disconnect the FireClient() on the server?

0

OmG IM sooo Stupid. (Your right Btw) I just forgot to do someting else.

0

Thank Ya :)

This discussion is preserved as it was. New answers, comments, and votes are closed.