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
 

Re: Event Issues

Previous Thread :: Next Thread 
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
18 Feb 2012 08:34 PM
There may be a little issue in the coding for some events. This is just an example that CONSISTENTLY does not work properly. I use ChildRemoved to fire an event to do some reparenting when a child is removed. However, upon reparenting the object, it would fire ChildRemoved (which is documented to fire AFTER the child is removed) and would then break everything (it's a little complicated to explain the process)

After using repeat wait() until not script.Parent:FindFirstChild(OBJ_NAME) it works properly now. Just an observation. Can this be fixed?? Perhaps the event needs to fire the function the frame after since the object handler doesn't seem to reparent until the new frame anyway.

"Locked" - Sorcus
Report Abuse
Ozzypig is not online. Ozzypig
Joined: 27 Mar 2008
Total Posts: 4906
19 Feb 2012 09:26 AM
Remember that event connections won't work if you hit the pinkish reset button next to the pause/play buttons.

And by don't work, I mean such that this:

(Instance.new("Model").ChildAdded:connect(function () end)).connected

Always returns false.
Report Abuse
Ozzypig is not online. Ozzypig
Joined: 27 Mar 2008
Total Posts: 4906
19 Feb 2012 09:26 AM
Oh by the way, ask me how many hours of sleep I lost finding that out if you get the chance.
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
19 Feb 2012 10:25 AM
I know that. This is in Start Server/Start Player

"Locked" - Sorcus
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
19 Feb 2012 10:37 AM
It is supposed to work that way. Just add wait() to make it wait one frame and that should fix the problem.

However, they should rename it to ChildRemoving, like PlayerRemoving.

They want you to be able to get the child's parent if you need it. As for reparenting it, the child hasn't been removed yet, so... :P
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
19 Feb 2012 10:44 AM
@JulienDethurens

There are two events: ChildRemoved and ChildRemoving. The wiki says that it fires AFTER the child has been removed, but it doesn't.

"Locked" - Sorcus
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
19 Feb 2012 10:56 AM
Don't always trust the wiki. The wiki is good for learning, but not as a reference. If you already know how to script, use the object browser instead, to refresh your memory.

There is no ChildRemoving object, I just verified.

print(Workspace.ChildRemoving) --> ChildRemoving is not a valid member of Workspace
Report Abuse
aboy5643 is not online. aboy5643
Joined: 08 Oct 2010
Total Posts: 5458
19 Feb 2012 11:01 AM
I see you beat me to the wiki then :)

"Locked" - Sorcus
Report Abuse
JulienDethurens is not online. JulienDethurens
Joined: 11 Jun 2009
Total Posts: 11046
19 Feb 2012 11:20 AM
It seems it fires after the child is removed.

Workspace.ChildRemoved:connect(function(child) print(child.Parent) end) Instance.new('Part', Workspace).Parent = nil --> nil
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