If statement ignoring false variable?

if (isShooting)
{
ShootGun();
isShooting = false;
}
Debug.Log(isShooting);

I’m trying to make enemy AI wherein when they fire, there is a delay between their firing and the next shot. However, this is the code where the problem area lies. Despite my EXPLICIT resetting of isShooting to False AND the Debug.Log verifying my actions, it seems like the if statement executes anyway. I’m SUPER confused as to why it’s doing this.

When isShooting is true, it will enter the statement and ShootGun will be called without any delay.
To add delay into any function you can use Invoke method as:

Invoke("ShootGun",2f);

The above command will call the function ShootGun after 2 seconds.