1 | game.StarterGui.health.white.BackgroundTransparency = 1 |
2 | game.StarterGui.health.white.red.BackgroundTransparency = 1 |
3 | game.StarterGui.health.white.red.green.BackgroundTransparency = 1 |
I'm trying to experiment with a health bar that I make so it's not appear when I'm in the neutral team which is for main menu. But I want to try to make it transparent at all team for now. I click run not play and it works. But when I click play it appears. Is there anything wrong with it?
The reason it only works on "run" is because the StarterGui
s were not replicated into the player because there aren't any. To fix this, use PlayerGui
which is inside the player.
01 | local players = game.Players:GetPlayers() --Setting out a table of the players. |
02 |
03 | for _,player in pairs (players) do --Looping through each player in the game |
04 |
05 | local playerGui = player:WaitForChild( "PlayerGui" ) --Defining a variable for the PlayerGui |
06 |
07 | playerGui.health.white.BackgroundTransparency = 1 |
08 | playerGui.health.white.red.BackgroundTransparency = 1 |
09 | playerGui.health.white.red.green.BackgroundTransparency = 1 |
10 |
11 | end |
Hope this helps!
Don't forget to accept this if it does!!