// Update is called once per frame
    void Update()
    {
        if (Input.GetButtonUp("StartScreen"))
        {
            // print("Menu Button Pressed");
            if (!startScreenActive)
            {
                if (!itemScreen.activeSelf)
                {
                    if (!unavailable)
                    {
                        //pauseScript.MenuOn();
                        //StartCoroutine(waitandfix());
                        ItemInventory.unavailable   = true;
                        TimeStop.unavailable        = true;
                        WeaponInventory.unavailable = true;
                        OpenStart();
                    }
                }
                else
                {
                    ItemInventory.unavailable = false;
                    itemScript.Closeitems();
                }
            }
            else
            {
                if (!itemScreen.activeSelf)
                {
                    ItemInventory.unavailable = false;

                    CloseStartScreen();
                    TimeStop.unavailable = false;

                    WeaponInventory.unavailable = false;
                    itemScreen.SetActive(true);

                    itemScript.OpenItems();
                }
                else
                {
                    CloseStartScreen();
                    ItemInventory.unavailable = false;
                    itemScript.Closeitems();
                }
            }
        }
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            //print("Menu Button Pressed");

            if (!startScreenActive)
            {
                //print("Startscreen was inactive");
                if (!itemScreen.activeSelf)
                {
                    // print("itemscreen was inactive");
                    if (!unavailable)
                    {
                        // print("Bool unavailable was false");
                        pauseScript.MenuOn();
                        //StartCoroutine(waitandfix());
                        ItemInventory.unavailable   = true;
                        TimeStop.unavailable        = true;
                        WeaponInventory.unavailable = true;
                        OpenStart();
                    }
                }
                else
                {
                    //  print("item screen was active");
                    itemScript.Closeitems();
                }
            }
            else
            {
                // print("Startscreen was active");
                if (!itemScreen.activeSelf)
                {
                    //print("itemscreen was imactive after startscreen was found active");
                    ItemInventory.unavailable = false;

                    CloseStartScreen();
                    TimeStop.unavailable = false;

                    WeaponInventory.unavailable = false;
                    itemScript.OpenItems();
                }
                else
                {
                    // print("itemscreen was also active");
                    CloseStartScreen();
                    itemScript.Closeitems();
                }
            }
        }
        if (Input.GetKeyUp(KeyCode.P))
        {
            if (!startScreenActive)
            {
                if (!unavailable)
                {
                    pauseScript.MenuOn();
                    ItemInventory.unavailable   = true;
                    TimeStop.unavailable        = true;
                    WeaponInventory.unavailable = true;
                    OpenStart();
                }
            }
            else
            {
                ItemInventory.unavailable = false;

                CloseStartScreen();
                TimeStop.unavailable        = false;
                WeaponInventory.unavailable = false;
            }
        }
    }