Disconnect (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Flurite
No edit summary
>JulienDethurens
CustomEvents don't have a disconnect method...
Line 1: Line 1:
<noinclude>{{Method
<onlyinclude>
{{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
}}
}}
{{clear floats}}
{{clear floats}}
</onlyinclude>


{{Example|
{{Example|
Below is an example of connecting a function and then disconnecting it.
This is an example of connecting a function and then disconnecting it:
<pre>
<code lua>
local Connection = script.Parent.Touched:connect(function()  
local connection = script.Parent.Touched:connect(function()  
print("Hit")
print("Hit")
end)
end)


Connection:disconnect() --the function will no longer print "Hit" when the script's Parent is touched.
connection:disconnect() --the function will no longer print "Hit" when the script's Parent is touched.
</pre>
</code>
}}[[Category:Methods]]
}}
 
There's also a method name Disconnect in [[CustomEvent]].
</noinclude>


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

Revision as of 07:26, 22 January 2012

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


Example
{{{1}}}