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

GUI Text change not working, When I go back on to the gui the text doesn't change. help?

Asked by 6 years ago

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.

1 answer

Log in to vote
0
Answered by
Thetacah 712 Moderation Voter
6 years ago

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 StarterGuiinstead 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";

Ad

Answer this question