Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can a Script Access the StarterGui? [closed]

Asked by 9 years ago

Can a script in the Workspace access the StarterGui? For example:

game.StarterGui.ScreenGui.TextButton.Visible = true

If not, what would you have to do to fix it? Thanks!

Locked by Goulstem and EzraNehemiah_TF2

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

3 answers

Log in to vote
1
Answered by 9 years ago

Yes, a script can access the StarterGui, but making changes in the StarterGui won't change the Gui's that a player is seeing. Any changes to gui's in the StarterGui will only change the gui's the appear when the player respawns.

If you want the script to be able to change a player's gui, use this directory instead: game.Players.LocalPlayer.PlayerGui. After PlayerGui, you can put the rest of the gui code.

NOTE: Make sure that code is in a localscript, or else it won't work

Hope this helped!

0
Thanks Turbo! sidekick83 80 — 9y
Ad
Log in to vote
1
Answered by
dyler3 1510 Moderation Voter
9 years ago

Yes, a script can access the StarterGui, but I wouldn't recommend doing so in-game. The StarterGui is just the template that gets copied into the player's PlayerGui's.

Scripts inside the StarterGui should be used to access player's individual Gui's. Therefore, you wouldn't want to go to the StarterGui to change things such as a TextButton.

For more about the StarterGui

For more about the PlayerGui

0
You're welcome... dyler3 1510 — 9y
Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Yes, but the guis you see in-game are stored in your player's PlayerGui.. not StarterGui. So to change how something looks for the client you need to access the gui through their PlayerGui.

Ex;

local plr

plr.PlayerGui.ScreenGui.TextButton.Visible = true
0
Thanks Goul! sidekick83 80 — 9y