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

Previous Thread :: Next Thread 
ENET is not online. ENET
Joined: 01 Jan 2010
Total Posts: 4820
06 Feb 2013 09:41 AM
Some of you are complaining you want wait for child so your guis don't break and you don't have to add the function to every script. Well I'm here to say: HUMBUG!

The wait for child method is only good when waiting for certain objects. In a gui, the idea is to wait for all of the gui to load. Using wait for child is inefficient. As a coder, you already know how many children are in your gui.

Let's say that we create this:
+ ScreenGui
++ Frame
++ Int Value
++ My Script

Gui = our screengui;
repeat wait(); until #Gui:GetChildren() >= 3
--because our screengui has 3 children
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
06 Feb 2013 09:42 AM
Ye, do it manly way!

repeat wait() until player:FindFirstChild("ScreenGui")
Report Abuse
ENET is not online. ENET
Joined: 01 Jan 2010
Total Posts: 4820
06 Feb 2013 09:44 AM
[[Ye, do it manly way!

repeat wait() until player:FindFirstChild("ScreenGui")]]

Won't work. Not even what we're talking about.
Sometimes a gui's script loads and runs before other objects in the gui are loaded. So you get an error because the object in the gui you try to index doesn't exist yet. Your code wouldn't work for this.
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
06 Feb 2013 09:46 AM
Lolk den, I failz at GUI's anywayz.
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
06 Feb 2013 10:02 AM
In my game, I have to put BBGs as a direct child of PlayerGui to prevent some ugly rendering. Due to the fact that the number of the children is always changing, your method is unreliable when I need to wait for StarterGuis to appear.
Report Abuse
ENET is not online. ENET
Joined: 01 Jan 2010
Total Posts: 4820
06 Feb 2013 11:53 AM
[[In my game, I have to put BBGs as a direct child of PlayerGui to prevent some ugly rendering. Due to the fact that the number of the children is always changing, your method is unreliable when I need to wait for StarterGuis to appear.]]

You don't use my method to test the PlayerGui, you use my method to test the ScreenGui.
Report Abuse
woot3 is not online. woot3
Joined: 10 Nov 2008
Total Posts: 3599
06 Feb 2013 11:54 AM
Y U No _G
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
06 Feb 2013 12:02 PM
An even better way would be to do something a bit more like:

repeat wait() until #script.Parent:GetChildren() == #game.StarterGui.ScreenGui:GetChildren()
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
06 Feb 2013 12:22 PM
"Y U No _G"

Because then we need a WaitForProperty; another one of the functions I put at the top of my scripts.
Report Abuse
BlakTankerCvC is not online. BlakTankerCvC
Joined: 31 Jan 2013
Total Posts: 586
06 Feb 2013 12:25 PM
i agree with preston up there ^
Report Abuse
Fattycat17 is not online. Fattycat17
Joined: 26 Jun 2011
Total Posts: 1527
06 Feb 2013 01:52 PM
Thanks for the tip :3
Report Abuse
BlakTankerCvC is not online. BlakTankerCvC
Joined: 31 Jan 2013
Total Posts: 586
06 Feb 2013 01:54 PM
i didnt give you a tip.... lol?
Report Abuse
TeamDman is not online. TeamDman
Joined: 04 Dec 2009
Total Posts: 897
06 Feb 2013 02:50 PM
Just create all GUIs in your script. :D

"Don't believe everything you read online" - Abraham Lincoln
Report Abuse
mew903 is not online. mew903
Joined: 03 Aug 2008
Total Posts: 22071
06 Feb 2013 04:27 PM
Or just add a "wait(.1);" at the beginning of your localscript???
Report Abuse
ArceusInator is not online. ArceusInator
Joined: 10 Oct 2009
Total Posts: 30553
06 Feb 2013 04:50 PM
"Just create all GUIs in your script. :D"

NO.
Report Abuse
AbsoluteLOL is not online. AbsoluteLOL
Joined: 01 Dec 2012
Total Posts: 3939
06 Feb 2013 04:52 PM
@Arceus
It's possible with a serialization plugin.
Other than that, I agree. NO.

[ AbsoluteLOL - TFN Prime General ]
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