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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|