|
| 01 Jul 2015 02:11 AM |
So, say you have a Gui that is in the starterGui, and you use a serverscript to pull the player out.
So, I always see in scripts this line:
local plr = script.Parent.Parent(etc) and it somehow magically gets the player, how is that possible?
I stole YOUR siggy! |
|
|
| Report Abuse |
|
|
DevRenza
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
|
| 01 Jul 2015 02:13 AM |
| The scripts parent's parent's parent like Script.Parent.Grandmother.GreatGrandmother.etc.. |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2015 02:15 AM |
Well what I meant is, here's the hierarchy, so, it goes, StarterGui>ScreenGui>Frame>TextButton,TextLabel,TextBox, but from the textbutton with a serverscript in it, it says: local Player = script.Parent.Parent.Parent.Parent.Parent, I know how script.Parent works, just not how it magically gets the player.
I stole YOUR siggy! |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
|
| 01 Jul 2015 02:16 AM |
ya bum whenever a player joins everything in the startergui goes into the players playergui and guess what the playergui is inside the player |
|
|
| Report Abuse |
|
|
DevRenza
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
| |
|
|
| 01 Jul 2015 02:18 AM |
But howww, I don't understanddd.
I stole YOUR siggy! |
|
|
| Report Abuse |
|
|
Funse
|
  |
| Joined: 11 Jun 2012 |
| Total Posts: 7887 |
|
| |
|
|
| 01 Jul 2015 02:19 AM |
No, for real, it's the PLAYER, not the playergui, nor the stuff inside the player, it's in general, the player.
I stole YOUR siggy! |
|
|
| Report Abuse |
|
|
DevRenza
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
|
| 01 Jul 2015 02:22 AM |
| So, when you load in the PlayerGui is under the player. So when you use the parent all its saying is basically just game.Players.Player(Not a function or variable just for understandment) |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 01 Jul 2015 02:29 AM |
| startgui elements gets replicated to the player's gui. You can only use localplayer in localscripts. You can't get the local player from a script in serverscriptservice. |
|
|
| Report Abuse |
|
|
|
| 01 Jul 2015 02:29 AM |
Ohh. Ok..
I stole YOUR siggy! |
|
|
| Report Abuse |
|
|
DevRenza
|
  |
| Joined: 12 Jun 2015 |
| Total Posts: 425 |
|
| |
|