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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 06 Feb 2013 09:46 AM |
| Lolk den, I failz at GUI's anywayz. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 3599 |
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 06 Feb 2013 12:25 PM |
| i agree with preston up there ^ |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Feb 2013 01:54 PM |
| i didnt give you a tip.... lol? |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 06 Feb 2013 04:50 PM |
"Just create all GUIs in your script. :D"
NO. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|