Aim ignoring script

As i said before, i am making an Aim System and i am getting humiliated here because my knowledge about C# is poor and i can’t do this in Javascript apparently.

So here is my Script:

using UnityEngine;
using System.Collections;

public class AimSys : MonoBehaviour
{
    bool Click = false; //This is a trigger.
    bool target = false;

    public float fireRate = 0.5F;
    private float nextFire = 0.0F;
    public GameObject Flash;


    void Update()
    {
        if (target = true)

            nextFire -= Time.deltaTime;
        if (Input.GetButton("Fire1") && nextFire <= 0)
        {
            Flash.SetActive(true);
            Debug.Log("Target Hit!");
            nextFire = fireRate;
        }

    }

    void OnCollisionEnter(Collision collision)
    {
        {
            if (collision.gameObject.tag == "Enemy")
                target = true;
        }
    }

    void OnCollisionExit(Collision collision)
    {
        {
            if (collision.gameObject.tag == "Enemy")
                target = false;
            Flash.SetActive(false);
        }
    }
}

This was supposed to do the following: There is a cillinder in front of my player’s weapon that is an Aim. In every frame the Aim will try to detect if there is something colliding with it. If there is something colliding with the Aim, it will search the object for the tag “Enemy”. If it has the tag “Enemy”, then for now a simple Log will show. Later i plan to replace the log by a small life reduce in the Enemy life bar.

The problem is that my Aim is detecting EVERYTHING as an Enemy somehow. It doesn’t ignore my fire rate, so it properly shoots every two seconds if i am pressing the mouse button (Auto-Fire). I think there is something wrong with the Update Function. I can shoot everywhere, no matter if i am hitting a collider or not, and the log will be shown. It seems that the collision is being ignored but still the log is being displaced. Also the flash that i am using only disappears when i hit something else.

Any idea to how to solve this? I must be missing something basic here, but as i said i don’t know much about C# yet.

if (target = true)

should be

if (target == true)

The first one is an assignment with will always evaluate to “true”,