Merely
|
  |
| Joined: 07 Dec 2010 |
| Total Posts: 17266 |
|
|
| 27 Jul 2012 10:20 PM |
I am connecting to Character.ChildAdded in a LocalScript as follows:
Character.ChildAdded:connect( function(child) child:Clone().Parent = game.Lighting -- to examine it later end
I created a local server, set my Player's Character Appearance to that of Shedletsky, and reset. After I spawned I check Lighting and found that there was an instance of the class 'Hat' but I had cloned the Hat before its handle had been added.
I need to wait until all of the children of the Hat have been added before I proceed. Would a simple 'wait()' statement work always or is there a better solution? |
|
|
| Report Abuse |
|
|
Merely
|
  |
| Joined: 07 Dec 2010 |
| Total Posts: 17266 |
|
|
| 27 Jul 2012 10:22 PM |
| If the children-of-the-hat-being-added occurs on the server then it seems no amount of waiting would guarantee that all the children ever arrive. Or is this some sort of client-side event in which case a simple 'wait()' would work always? |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 27 Jul 2012 10:27 PM |
| I couldn't follow a word you're saying. To me every word you type just kind of blended in together. |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 27 Jul 2012 10:29 PM |
| Also, you forgot a ")" in your script. That might be the problem, or you need moar hats. |
|
|
| Report Abuse |
|
|
BAUER102
|
  |
| Joined: 03 Apr 2010 |
| Total Posts: 5936 |
|
|
| 27 Jul 2012 10:30 PM |
uh, I'm not 100% sure, that I've understood you, but if I'm right
you could try to do a
while (#child:GetChildren() < 1) do wait() end
to wait, until the children are loaded? |
|
|
| Report Abuse |
|
|
mustyoshi
|
  |
 |
| Joined: 27 Dec 2007 |
| Total Posts: 41651 |
|
|
| 27 Jul 2012 10:33 PM |
Yeah Bauer is right, you can't expect ROBLOX to give you any sore of consistant delay, so you'll just have to wait for children.
~Monica |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jul 2012 10:33 PM |
> Also, you forgot a ")" in your script.
You're right. The script I typed here was a from memory, so it's not what I used. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jul 2012 10:34 PM |
> Yeah Bauer is right, you can't expect ROBLOX to give you any sore of consistant delay, so you'll just have to wait for children.
Well I tried wait() and it seemed to work. Is it because the client is in the process of adding the children of the Hat, and is calling the event in the meanwhile? If so, wait() will work every time. |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 27 Jul 2012 10:39 PM |
| Try "Game:GetService("RunService").Stepped:wait()" instead of "Wait()", it returns "0.033333~~~" for the wait period every time. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jul 2012 10:53 PM |
| @mew wht's the advantage? is that the lowest possible wait time? |
|
|
| Report Abuse |
|
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 27 Jul 2012 10:54 PM |
| The lowest one I know of. It's usually 0.01 seconds faster than normal Wait'' (in a non laggy server). |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
|
| 27 Jul 2012 10:58 PM |
| Merely is trying to wear other people's hats because all isn't enough for him. |
|
|
| Report Abuse |
|
|
xSIXx
|
  |
| Joined: 06 Aug 2010 |
| Total Posts: 9202 |
|
|
| 27 Jul 2012 10:59 PM |
omg hats.
must hav 2 look good kkthx |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jul 2012 11:01 PM |
You guys figured it out. Here's the full script.
local HatIds = ... -- list of all the assetIds of all the Hats on ROBLOX, it would break the forums if i posted the full thing
for _, id in pairs(HatIds) do local model = game:GetService("InsertService"):LoadAsset(id) if model then for _, child in pairs(model:GetChildren()) do child:Clone().Parent = Workspace.Merely -- muhahaha end end end |
|
|
| Report Abuse |
|
|
| |
|
mew903
|
  |
| Joined: 03 Aug 2008 |
| Total Posts: 22071 |
|
|
| 27 Jul 2012 11:10 PM |
| I bet he would cry irl if Merely and Seranok got perma'd one day. |
|
|
| Report Abuse |
|
|
Merely
|
  |
| Joined: 07 Dec 2010 |
| Total Posts: 17266 |
|
|
| 27 Jul 2012 11:11 PM |
| When's the last time a lifetime OBCer got perma'd? Be serious. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:12 PM |
"You need to see a doctor."
No.
He needs to go see two doctors. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 27 Jul 2012 11:13 PM |
| No... I don't have dual personalities... I don't care what you say!!! >:( |
|
|
| Report Abuse |
|
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 27 Jul 2012 11:17 PM |
| object.ChildAdded:wait() is the best method. Both syntactically elegant and the most efficient. |
|
|
| Report Abuse |
|
|
oxcool1
|
  |
| Joined: 05 Nov 2009 |
| Total Posts: 15444 |
|
| |
|
stravant
|
  |
 |
| Joined: 22 Oct 2007 |
| Total Posts: 2893 |
|
|
| 27 Jul 2012 11:20 PM |
"When's the last time a lifetime OBCer got perma'd? Be serious."
They might get more lenience in some cases, but they also certainly do get banned. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:24 PM |
"They might get more lenience in some cases"
What?
Seriously?
Why would OBC members get more lenience than non-OBC members? |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2012 11:25 PM |
"When's the last time a lifetime OBCer got perma'd? Be serious."
You think that's gonna stop them? They already got your money, you would've been much safer buying monthly. |
|
|
| Report Abuse |
|
|