So, I have this game where when you spawn in, you have a red and blue block GUI representing the red and blue team.
Whichever block you click on, you become apart of that team.
When you click on red for example, you die and respawn on the red team, but here's the problem.
I want it so that if you are on the red or blue team, the teamchange gui that appears when you first spawn, that should become invisible when you join one of these teams and respawn.
Here is the script I have so far.
The script I am using is inside a local script and is merged with another script I am using.
wait(1)
local blue = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Blue
local red = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Red
local player = game.Players.LocalPlayer
local gui = game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame
blue.MouseButton1Click:Connect(function()
player.TeamColor = BrickColor.new("Bright blue")
game.Players.LocalPlayer.Character.Humanoid:TakeDamage(100)
end)
if game.Players.LocalPlayer.Team == "Blue" then
gui.Visible = false
end
Help is appreciated!

9 comments
gui is nil when used outside of its scope
What do you mean "outside of its scope"
a loop block is a "scope" and that "scope" is above the local variable's "scope"
so the variable isn't seen
How do I remove the GUI when the player is on another team?
gui is visible in lower scopes. Please stop spreading misinformation about local variables thanks
Are you talking to me?
Just destroy the Gui. Where is the script? Is it inside the button or what?
Just destroy the Gui. Where is the script? Is it inside the button or what?