game.StarterGui.health.white.BackgroundTransparency = 1 game.StarterGui.health.white.red.BackgroundTransparency = 1 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.
local players = game.Players:GetPlayers() --Setting out a table of the players. for _,player in pairs(players) do --Looping through each player in the game local playerGui = player:WaitForChild("PlayerGui") --Defining a variable for the PlayerGui playerGui.health.white.BackgroundTransparency = 1 playerGui.health.white.red.BackgroundTransparency = 1 playerGui.health.white.red.green.BackgroundTransparency = 1 end
Hope this helps!
Don't forget to accept this if it does!!