generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Disconnecting an object's parent event

Previous Thread :: Next Thread 
Sanctity is not online. 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
18cwatford is not online. 18cwatford
Joined: 08 Oct 2009
Total Posts: 5410
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
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
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 is not online. 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
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
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 is not online. 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 is not online. 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 is not online. 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 is not online. stravant
Forum Moderator
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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image