I'm new to scripting and I need help with this. game.StarterGui.hi.Frame.ShopAndInfoBar.TextLabel.Text = "hello" When I open the GUI again it doesn't come up and when I try to put it without the "" it has errors. please help.
Please use the "Lua Code Block" button when pasting your script.
game.StarterGui.hi.Frame.ShopAndInfoBar.TextLabel.Text = "hello"
The following code has the correct syntax, however, you are changing StarterGui
instead of PlayerGui
.
When a player spawns into a game or resets, everything in the StarterGui gets cloned inside of their own PlayerGui. What that means is, while you may make changes to StarterGui elements, you will not physically see them change on your screen until they're cloned to your client upon reset.
Instead, what you want to do is update PlayerGui in a localscript
, meaning no access to the server.
Insert the localscript in the "hi" ScreenGui.
You can then refer to the textlabel in such way:
--localscript local TL = script.Frame.ShopAndInfoBar.TextLabel; --You can then change the text, as you did. TL.Text = "hello";