Disconnect (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
CustomEvents don't have a disconnect method...
>Legend26
Page shouldn't exist. This is why we have the RBXScriptConnection page.
Line 1: Line 1:
<onlyinclude>
#REDIRECT [[RBXScriptConnection#Methods]]
{{Method
|name = disconnect
|description = Disconnects a function from an event so it is no longer active.
|object = Event
}}
{{clear floats}}
</onlyinclude>
 
{{Example|
This is an example of connecting a function and then disconnecting it:
<code lua>
local connection = script.Parent.Touched:connect(function()
print("Hit")
end)
 
connection:disconnect() --the function will no longer print "Hit" when the script's Parent is touched.
</code>
}}
 
[[Category:Methods]]

Revision as of 00:48, 21 March 2012