Disconnect (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Emess
No edit summary
>ArceusInator
No edit summary
Line 1: Line 1:
<onlyinclude>{{Method
<noinclude>{{Method
|name = disconnect
|name = disconnect
|description = Disconnects a function from an event so it is no longer active.
|description = Disconnects a function from an event so it is no longer active.
|object = Event
|object = Event
}}</onlyinclude>
}}


{{clear floats}}
{{clear floats}}
Line 16: Line 16:
Connection:disconnect()
Connection:disconnect()
</pre>
</pre>
}}
}}[[Category:Methods]]
 
There's also a method name Disconnect in [[CustomEvent]].
</noinclude>


[[Category:Methods]]
{{AdminOnlyMethod
|name=Disconnect
|arguments=[[CustomEventReceiver]] ''receiver''
|description=Disconnects the ''receiver'' from the [[CustomEvent]].
|object=CustomEvent}}

Revision as of 22:09, 26 July 2011

disconnect( )
Returns nil
Description: Disconnects a function from an event so it is no longer active.
Member of: Event


Example

Below is an example of connecting a function and then disconnecting it.

local Connection = script.Parent.Touched:connect(function()
print("Hit")
end)

Connection:disconnect()

There's also a method name Disconnect in CustomEvent.


Disconnect( CustomEventReceiver receiver )
Returns nil
Description: Disconnects the receiver from the CustomEvent.
In Object: CustomEvent