Set a Guns Firerate

Hello,
I have a script for a gun wich works fine, but i want to make it that the gun has a firerate like 500 Bullets per Minute.

using UnityEngine;
using System.Collections;

public class Assault : MonoBehaviour {

    public AudioClip ShootingSound;
    public AudioClip Hitmarker;

    public int Damage;

    public float Cooldown;
    public float CooldownRemaining;
    public GameObject Spark;

    Enemy Enemy;

    // Use this for initialization
    void Start () {

    }
  
    // Update is called once per frame
    void Update () {
        RaycastHit rayHit;
        Ray ray = new Ray (transform.position + transform.forward * 0.4f, transform.forward);

        CooldownRemaining -= Time.deltaTime;

        if (Input.GetButton ("Fire1") && CooldownRemaining <= 0) {
            CooldownRemaining = Cooldown;

This is not all of the Script but i think you dont need more?

PS: I know the Cooldown works fine but i want to have the firerate to be set easiely.

Setting Cooldown to a lower number doesn’t work? I don’t see anything wrong with this script.

It works but if i set the Cooldown to 0.1 i don’t know how much bullets i can shoot in one minute.

.1 should fire off 10/sec… or 600/minute … tweak the math to your liking. or

int roundsPerMin = 500; // or whatever

void Start(){
     GetFireRate();
}

void GetFireRate(){
     CoolDown = roundsPerMin / 60;  // 60 sec per min... get rounds per sec
     CoolDown = 1 / CoolDown;  // now timing to get that many shots in 1 sec

     // for 500 cooldown should be about .12
}