Changing textlabel properties

Hello, noob programmer here
For one of my first projects, I’m trying to make an 8ball script

StarterGui > Folder > Screengui > Textlabel (the focus)

The code is:

game.StarterGui.Eightball.AnswerDisplay.TextLabel.Text = ("New Text")

It’s obviously not the full script, but I was testing with this and I could not find any way to make this script change the textlabel’s property, which is the text.

What did I do wrong? Please keep words simple, consider that the most advanced thing I can probably make is an 8ball game. (In case you’re unfamiliar 8ball is a fortune teller)

Turns out I just had the wrong path, thanks guys!

Try using a LocalScript to change the text value within each player’s PlayerGui rather than in StarterGui.

2 Likes

Don’t use parenthesis when changing text.

game.StarterGui.Eightball.AnswerDisplay.TextLabel.Text = “New Text”

2 Likes

Status: Tried all of these, none seem to work so far (I’m already using localscript and paranthesis issue didn’t seem to fix it

Thank you for the help nevertheless!

1 Like

Is the LocalScript changing the text value in the player’s PlayerGui?

1 Like

So you’ll want to use a local script in order to interact with someone’s client like this.

Assuming you’ve put the text label into SarterGui, when you actually join the server it will be in “PlayerGui” which is a folder accessible in Player > EpicCheatCodes (Or anybody else in players) > PlayerGui

An easy way to make sure you always have instant access to this text label is to put the local script inside the label itself in StarterGui.

2 Likes

Instead of game.StarterGui do game.Players.LocalPlayer.PlayerGui

4 Likes

If Epic’s solution didn’t work, I can’t see any other way you would fix this. Are you sure this is the only part of your code that could be going haywire?

Also, Ryuunske should’ve clarified this: The parentheses wouldn’t break anything, it’s just bad practice because the parentheses are unnecessary here.

2 Likes