Zecrit
|
  |
| Joined: 24 Jan 2013 |
| Total Posts: 2618 |
|
|
| 04 Jun 2014 06:34 AM |
Because I'm just working on a GUI and the parent I need to get to has to be listed like: script.Parent.Parent.Parent.Parent.Parent.(Thing) Can this be shortened just for perfectionism and aesthetic purposes? |
|
|
| Report Abuse |
|
|
Ultraw
|
  |
| Joined: 20 Nov 2010 |
| Total Posts: 6575 |
|
|
| 04 Jun 2014 06:41 AM |
No, what you need to do is define what you need at the start of the script as a variable. For example: frame = script.Parent.Parent.Parent. From there, just use "frame" when use it.
|
|
|
| Report Abuse |
|
|
|
| 04 Jun 2014 06:41 AM |
Nope.
...As far as i'm concerned... |
|
|
| Report Abuse |
|
|
Zecrit
|
  |
| Joined: 24 Jan 2013 |
| Total Posts: 2618 |
|
| |
|
|
| 04 Jun 2014 07:22 AM |
plr = script.Parent repeat plr = plr.Parent until plr:IsA('Player') |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2014 08:52 AM |
It's best to start off from the player down.
wait(1) local Player = game.Players.LocalPlayer local MyGui = Player.PlayerGui.MyGui
local Frame1 = MyGui.Frame1 local F1Btn = Frame1.ClickyButton local F1Label = Frame1.FunnyJokeLabel
local TestFrame = MyGui.Frame2 local TFBtn = TestFrame.AnotherClickyButton local TFLabel = TestFrame.HorribleJokeLabel local TFLabelFunny = TFLabel.Funny.Value --> this happens to be false!
I hope I didn't go too far. :o
I also recommend having ONE script directly under the ScreenGui object. That way you KNOW for a FACT where the ScreenGui is and all of its children. Don't forget to use a LocalScript, as normal Scripts do not run in the PlayerGui. |
|
|
| Report Abuse |
|
|