I am trying to disable this gui and for some reason it is not working. When I test the game and manually uncheck the enable gui box it goes away and when I run this script tell it to change the name of the gui it works but for some reason I can’t disable it using script.
local gui = player1.PlayerGui:FindFirstChild("LeaveCourt1Spot1A")
gui.Enabled = false
This exact code is working on other parts of the game also. Does anyone know what might be wrong.
This is the full block of code. What it does is wait until a team has 1 player which is “TeamNumber” then it makes a table of every player in that team and calls the first player in that team player1 and when I print it in game it says “emrek”. And I can change other values like the name of the GUI.
Team1.PlayerAdded:Connect(function(Player)
if #Team1:GetPlayers() == TeamNumber and #Team2:GetPlayers() == 0 then
local players = Team1:GetPlayers()
local player1 = players[1]
local humanoidRoot = player1.Character.HumanoidRootPart
local spawnSpot1A = court.SpawnSpot1A
local gui = player1.PlayerGui:FindFirstChild("LeaveCourt1Spot1A")
gui.Enabled = false
humanoidRoot.CFrame = spawnSpot1A.CFrame * CFrame.new(0,10,0)
humanoidRoot.CFrame = humanoidRoot.CFrame * CFrame.Angles(0,math.rad(180),0)
end
end)