I am trying to close the GUI if its already active and the user clicks

void Update()
{
if (Input.GetMouseButtonDown(0))
{
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, 1000))
// adjust the hit distance for the raycast distance to load the GUI
{
FloorGUI.SetActive(true);
Debug.Log(“FLOOR CLICKED - LOADING GUI FOR CUSTOMER SELECTION”);
}

        else
        {
            Debug.Log("FLOOR NOT CLOSE ENOUGH FOR RAYCAST - WILL NOT LOAD GUI FOR CUSTOMER SELECTION");
        }

        if (Input.GetMouseButtonDown(0))
            FloorGUI isActiveAndEnabled
            FloorGUI.SetActive(false);
        Debug.Log("CLOSING GUI, FLOOR HAS BEEN RE-CLICKED WITH GUI ACTIVE");

    }
}

}

test thid code

 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         RaycastHit hit;
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(ray, out hit, 1000))
         // adjust the hit distance for the raycast distance to load the GUI
         {
             FloorGUI.SetActive(!FloorGUI.activeSelf);
         } 
        else
         {
             Debug.Log("FLOOR NOT CLOSE ENOUGH FOR RAYCAST - WILL NOT LOAD GUI FOR CUSTOMER SELECTION");
         }
     }
 }

That worked brilliantly! Thank you very much.

So i learn, may i ask what exactly is the difference in code? And how does it work this way?