How can you disable the Traitor equipment menu for just one round?

Hey, I’m trying to disable the T menu as said in the title, however it doesn’t seem to be working.
Here is the code I have at the moment:
(we are using a custom t menu - which is what eqframe is)


--if SERVER then
  AddCSLuaFile()
  
  
  local fun_round_num
  local funrounds = {}
  
  local Preparing = function()
    --if SERVER then
      hook.Remove("TTTBeginRound","BEGINFUNROUND")
      hook.Remove("TTTEndRound","ENDFUNROUND")
      rounds_left = GetGlobalInt("ttt_rounds_left",6)-2
      if true then-- rounds_left == 0 then
        fun_round_num = 2--math.random(#funrounds)
        funrounds[fun_round_num]()
      end
   -- end
  end
  
  funrounds[1] = function()
    local function BeginRound()
      if SERVER then
        game.ConsoleCommand("sv_gravity 150
")
        game.ConsoleCommand("phys_timescale 0.25
")
      end
    end
    local function EndRound()
      if SERVER then
        game.ConsoleCommand("sv_gravity 600
")
        game.ConsoleCommand("phys_timescale 1
")
      end
    end
    hook.Add("TTTBeginRound","BEGINFUNROUND",BeginRound)
    hook.Add("TTTEndRound","ENDFUNROUND",EndRound)
  end
  
  funrounds[2] = function()
    local function BeginRound()
      if CLIENT then
        if IsValid(eqframe) then
          eqframe.Think = function( s ) s:Close() end
        end
      else
        tnum = tostring(math.floor(#player.GetAll() / 8)+1)
        game.ConsoleCommand("ttt_traitor_max "..tnum.."
")
        game.ConsoleCommand("ttt_detective_max 0
")
        for _,entity in ipairs(ents.GetAll()) do
          if entity:IsWeapon() then
            entity:Remove()
          end
        end
        
        hook.Add("Think","GiveHSKnives",function()
          for _,ply in ipairs(player.GetAll()) do
            if not(ply:IsGhost() or not ply:Alive()) then
              if (ply:GetRole() == ROLE_TRAITOR) then
                ply:Give("weapon_ttt_knife")
                for _,knife in pairs(ply:GetWeapons()) do
                  knife.SecondaryAttack = function(self)
                    return
                  end
                  knife.AllowDrop = false
                end
              end
            end
          end  
        end)
      end
    end
    
    local function EndRound()
      if SERVER then
        game.ConsoleCommand("ttt_traitor_max 32
")
        game.ConsoleCommand("ttt_detective_max 32
")
        hook.Remove("Think","GiveHSKnives")
      end
    end
    
    hook.Add("TTTBeginRound","BEGINFUNROUND",BeginRound)
    hook.Add("TTTEndRound","ENDFUNROUND",EndRound)
  end
  
  hook.Add("TTTPrepareRound","PREPAREFUNROUND",Preparing)
--end

It’s probably defined locally therefore you’re unable to access it in the scope you’re attempting.
You could try assigning the frame to a local variable defined outside of the functions if it’s in the same script, or attach it to the local player and access it that way.

First of all, it’s not in the same script. Also, it is global.

So is that error you originally posted no longer occurring then?
The one that said that eqframe was nil.
If so, I am unable to help you any further because I’ve never really touched TTT and am not really sure about the inner-workings of it.

That error I posted was from something else so I removed it.