Controlling the offset of a texture

Hey guys, i got this script from the manual:

function Update () {
    var offset : float = Time.time * scrollSpeed;
    renderer.material.SetTextureOffset ("_MainTex", Vector2(offset,0));
}

The way it is now the texture will keep offseting and needs 2 repeat(wrap mode), what i wanna do is to make the offset of the texture when reach say 1 returns to -3 and keep looping that way so i can clamp the texture. Any help will be appreciated since i’m new 2 programming

private var currentOffset : float = -3;
var resetTo : float = -3;
var maxOffset : float = 1;

function Update()
{
    currentOffset += Time.deltaTime * scrollSpeed;
    if(currentOffset > maxOffset)
    {
        currentOffset = resetTo;
    }
}