Infintely scrolling texture ends?(only scrolls through once)

Hi, I am currently making a simple 2d game. I wanted to have an endlessly scrolling background(scrolling vertically) so i used a script to make it scroll with the texture offset. Here is my current script:

 #pragma strict

private var offsetY : float;
function Update () 
if (renderer.material.mainTextureOffset.y<0.8){
    renderer.material.mainTextureOffset = Vector2(0,offsetY);
    offsetY += 0.1 * Time.deltaTime;

And the plane that it is attached to is a child of the main camera. It scrolls once, but then it ends. Here is a screenshot:

The texture just becomes plain black. Any ideas. (Also my graphics aren’t this bad, i’m just starting mechanics).

Select the texture you are using for the material. Then in the Inspector, change Wrap Mode from ‘Clamp’ to ‘Wrap’.