void ShootBullet() { if (activated) { if (inPursuit) { //Spawn Bullet BulletScript bullet = Instantiate(bulletPrefab, transform.position + Vector3.up * 0.5f, Quaternion.identity).GetComponent <BulletScript>(); bullet.transform.LookAt(play.transform.position + Vector3.up * 0.5f); //give bullet some random random trajectory bullet.transform.eulerAngles += Vector3.up * Random.Range(-aimInaccuracy, aimInaccuracy); bullet.bulletSpeed *= 1.5f; bullet.PoliceTrace(); bullet.shotFromPolice = true; } } Invoke("ShootBullet", Random.Range(shootFrequencyMin, shootFrequencyMax)); }