IndexOutOfRange when using Lerp

So here is the relevant code:

void Update () {
    //t += Time.deltaTime;
    //print(t);

    renderer.material.color = Color.Lerp(start, end, 5);

    if (renderer.material.color.a <= 0.0)
        Destroy(gameObject);
        
}

So I don’t get why it’s giving the IndexOutOfRange exception. I’m most certainly sure that it’s the number I give it(5 in this case). I have even tried putting an f after the numner(like 5f) to make sure it’s a float but to no avail. Any clarification would be really helpful. Maybe I’m just not understanding Lerp enough.

Edit: So I noticed that this isn’t all the relevant code. The exception is actually happening in a whole different class which is this one:

public class RandomSprite : MonoBehaviour {

    public Sprite[] sprites;
    public string resourceName;
    public int currentSprite = -1;

	// Use this for initialization
	void Start () {
        if (resourceName != "") {
            sprites = Resources.LoadAll<Sprite>(resourceName);
            if (currentSprite == -1)
                currentSprite = Random.Range(0, sprites.Length);
            else if (currentSprite > sprites.Length)
                currentSprite = sprites.Length - 1;
            **GetComponent<SpriteRenderer>().sprite = sprites[currentSprite];**
        }
	
	}

The line within the asterisks is the line that the error is pointing to.

There is nothing here that will generate an IndexOutOfRange. You need to provide your entire script and a copy of the exact error message from the console. As for this code, Lerp() takes values between 0.0 and 1.0. A value of 0.5 will produce an output half way between ‘start’ and ‘end’. A value of 5 will get rounded to 1 and will return ‘end’. There is an eased form of Lerp that can be used this way:

 renderer.material.color = Color.Lerp(renderer.material.color, end, Time.deltaTime * 5.0);