Sanctity
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 3 |
|
|
| 20 Aug 2013 07:17 PM |
The title explains most of this. What I am attempting to do is disconnect a event using an object inside it. To put this into code, here it is.
function check(obj) obj.ChildAdded:connect(objCheck) end
function objCheck(obj) obj.Parent.ChildAdded:disconnect(objCheck) end
Workspace.ChildAdded:connect(obj)
That does not to seem to work however. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2013 07:21 PM |
local connection; connection = script.Parent.ChildAdded:connect(function(obj) connection:disconnect() end)
Thats really as close as you get. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2013 07:22 PM |
| Event:disconnect is deprecated. Use RBXSignal:disconnect instead. Also, for future reference, threads like this belong in Scripting Helpers. This forum is for casual discussion, not where you should post help requests. |
|
|
| Report Abuse |
|
|
Sanctity
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 3 |
|
|
| 20 Aug 2013 07:24 PM |
"This forum is for casual discussion, not where you should post help requests."
Sadly, this is probably more on topic than nearly 90% of threads that are posted here. |
|
|
| Report Abuse |
|
|
|
| 20 Aug 2013 07:25 PM |
| True, but that doesn't mean you should post it here. Worse though is the fact that you apparently know this is not the place and disregard it anyways. |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 20 Aug 2013 07:25 PM |
>RBXSignal:disconnect I am still confused by this. |
|
|
| Report Abuse |
|
|
Sanctity
|
  |
| Joined: 09 Mar 2011 |
| Total Posts: 3 |
|
|
| 20 Aug 2013 07:26 PM |
"True, but that doesn't mean you should post it here. Worse though is the fact that you apparently know this is not the place and disregard it anyways."
Worse is the fact that people in Scripting Helpers don't know what they're doing. |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 20 Aug 2013 07:32 PM |
>RBXSignal:disconnect I am still confused by this.
He means RbxSignal::Disconnect
It's a method inside of the class RbxSignal that disconnects the signal.
~ Linguam latinam est optimum ~ |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 20 Aug 2013 07:51 PM |
A better solution in your case would be to use a wait, or if you need more than one invocation of the event, a wait-loop:
while true do local sibling = obj.Parent.ChildAdded:wait() if check(sibling) then process(sibling) break end end |
|
|
| Report Abuse |
|
|
woot3
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
|
| 20 Aug 2013 08:04 PM |
How does one use the new disconnect then? I still do not entirely understand it, just an example will be fine. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 20 Aug 2013 08:06 PM |
x = script.Parent.Touched:connect(touchy) x:disconnect() |
|
|
| Report Abuse |
|
|
dekkonot
|
  |
| Joined: 22 Dec 2010 |
| Total Posts: 6685 |
|
|
| 20 Aug 2013 08:07 PM |
I honestly don't know. x3
~ Linguam latinam est optimum ~ |
|
|
| Report Abuse |
|
|