Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the transparancy only work for a few seconds?

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?

1 answer

✓ Accepted answer

The reason it only works on "run" is because the StarterGuis 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!!

2 comments

1

Wow it works. Thanks for the PlayerGUI info mate!

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.