Unity C# My rate of bullets fired is changing value but not taking effect?

So basically I’m trying to make it so that i can change weapons, which for now is just going to change the rate of bullets coming out of the gun. So it all works with obtaining the new weapon and switching to that weapons rate of fire. However when i shoot the same amount of bullets are still being produced.

Some assistance would be much appreciated cause I’m really at a loss.

public class PlayerShooting : MonoBehaviour
{

public PlayerInventory inventory;
public Transform muzzlePoint;
public GameObject projectile;

[Range(0.1f, 300f)]
public float projectilesPerSecond;
private float projectileDelay;
public float projectileTimer;

// Use this for initialization
void Start()
{
    projectileDelay = 1.0f / projectilesPerSecond;

}

// Update is called once per frame
void Update()
{
    if (Input.GetKeyDown("2") && inventory.ContainsItem("SecondGun"))
    {
        projectilesPerSecond = 10f;
    }

    if (Input.GetKeyDown("1"))
    {
        projectilesPerSecond = 2.5f;
    }

    if (Input.GetButton("Fire1"))
    {
        Fire();
    }

    else if (projectileTimer > 0)
    {
        projectileTimer = Mathf.Clamp(projectileTimer - Time.deltaTime, 0.0f, projectileDelay);
    }

}

private void Fire()
{
    projectileTimer -= Time.deltaTime;

    while (projectileTimer <= 0)
    {
        Instantiate(projectile, muzzlePoint.transform.position, muzzlePoint.transform.rotation);

        projectileTimer += projectileDelay;
    }
}

}

If you change your projectiles per Second you also need to recalculate your shooting delay (projectileDelay)

so just add

projectileDelay = 1.0f / projectilesPerSecond;

after you change projectilesPerSecond in your Update Function