How to make shortcuts using two keys

Hello everyone!

I’m currently working on a script that will handle some key shortcut. They have to be in like “ctrl + Key”.

I already tried this solution found on the internet:

 void Update () {
    if (Input.GetKey(KeyCode.LeftControl)&&Input.GetKey(KeyCode.A))
    {
        //Do something
    }

    if (Input.GetKey(KeyCode.RightControl))
    {
        if (Input.GetKey(KeyCode.Z))
        {
            //Do something 
        }
        
    }

}

Apparently it works only if I push the two keys at the same time wich is not very convenient.

So I would like to know if there was any other way to do it so you could push the key one after another in a given order? (CTRL and A, and not A and CTRL).

I hope I made myself clear as english is not my native language.

Thank you by advance!

bool wasKeyADown;

void Update () {

    if(Input.GetKey(Keycode.LeftControl) && Input.GetKey(Keycode.A) && !wasKeyADown)
    {
        //Have a party
    }

    wasKeyADown = Input.GetKey(KeyCode.A);
}