Ad
Log in to vote
0

Not Able to change the text on my textlabel? Maybe a Bug?

Asked by 2 years ago
Edited 2 years ago

So this is really simple, I noticed my script was not changing the text on my gui so I decided to do a test. But it just doesn't work, no output or anything.

In a local Script, inside starter Gui

script:


local Gui = game.StarterGui.Click.TextLabel Gui.Text = "test"

2 answers

Log in to vote
1
Answered by
Soban06 410 Moderation Voter
2 years ago

Try doing this:

local Player = game.Players.LocalPlayer

local textLabel = game.Players[Player.Name].PlayerGui.Click.TextLabel

textLabel.Text = "test"
Ad
Log in to vote
1
Answered by 2 years ago

To explain what @Soban06 did:

The StarterGui is a folder which gets copied to a player who joins' folder. (When a player joins, he gets a "personal folder" which is game.Players.<playerName>).

So when your player joins, the content of the StarterGui Folder gets copied into the "personal folder".

So, when you try to change a specified player's gui, you have to change it in the "personal folder" (game.Players.<player>.PlayerGui in this case).

Ummm just a small tipp at the end: Keep in mind, that game.Players.LocalPlayer can only be used in a LocalScript.

PS 1: The script you made, changes the text on the textlabel for players who join after the script executed.

PS 2: @Soban06, it would be nice if you can explain your script next time, this site is called "scripting HELPERS" not "script REQUESTS where no one knows what a script even is".

If you got any questions, I'm here ;)

0
Thank You ! NovaGooBoom 42 — 2y

Answer this question