void Update() { if (attackTimer > 0) { attackTimer -= Time.deltaTime; } if (attackTimer < 0) { attackTimer = 0; } // Check for attack key if (Input.GetKeyUp(KeyCode.F)) { if (attackTimer == 0) { Attack(); attackTimer = coolDown; } } }