How do i make if a key is held down it does something but if just pressed does something else.

So the problem I am running into is I am trying to make a game where you switch from tool to weapon if Q is pressed but if held down which ever one your using at that time is dropped but every time I hold it down it still switches to a different item and drops that one instead of the one that I tried to drop since I can’t explain to good like this let me show you the main things. NOTE some of the things in this code doesn’t matter because I am not done yet so yeah.

public PTool Tool;
public PWeapon Weapon;
private Camera cam;
public bool UsingWeap;
public bool UsingTool;

void Update() {
//When somethings in your inventory
if (Weapon != null)
{

    }
    if (Input.GetKeyDown(KeyCode.Q))
    {
        if (UsingWeap == true)
        {
            UsingTool = true;
            UsingWeap = false;
        }
        else {
            if (UsingTool == true) {
                UsingWeap = true;
                UsingTool = false;
            }
        }
    }
    else {
    if (Input.GetKey(KeyCode.Q)) {
        Drop();
    }
}
    if (Input.GetKeyDown(KeyCode.E))
    {
        PickUp();
    }
    else { }

The problem is that your code does not match what you want. GetKeyDown is always called first and GetKey is always called second. What you need is to distinguish between both cases, so one of them happen only. Since pressing and holding are both kind of time based, you could count time up on getkey. on getkeyup however you check if a certain time has passed. if below e.g. .2f seconds, it’s a press and above it’s a hold. Execute code then. you can reset the counted time to 0 on getkeydown