Answered by
8 years ago Edited 8 years ago
I assume that you want to turn player's TextLabel invisible. Your problem is that you didn't include Player
. By doing:
1 | game.Players.Name.PlayerGui.Regen.TextLabel |
You are "telling" the script to find player with name "Name" which doesn't have to exist.
to get player from ServerScript you may use PlayerAdded event
1 | game.Players.PlayerAdded:connect( function (player) |
Now that we have Player variable we can access to the Player's PlayerGui.
The final script:
1 | game.Players.PlayerAdded:connect( function (player) |
2 | local TextLabel = player.PlayerGui.Regen.TextLabel |
3 | TextLabel.Visible = false |
Note that this will happen when player joins the game.
To do this whenever you want just use LocalScript.
For Player variable type this:
1 | local Player = game.Players.LocalPlayer |