Script error

Hello, I’m new to programming in C #, and I was trying to create a Flappy Bird type game, just to get used to a bit with C #, but whenever I do a script to make my scenario move gives some annoying error , That whenever I fix something happens in another error, I would be very happy if anyone could help me, sorry for my bad English, I am using google translator =)

My script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveOffset : MonoBehaviour {

private Material currentMaterial;
public float speed;
private float offset;
	

// Use this for initialization
void Start () {

	currentMaterial = renderer.material;
	
}

// Update is called once per frame
void Update () {

	offset += 0.001f;

	currentMaterial.setTextureOffset ("_MainTex", new Vector2 (offset * speed, 0));
	
}

}

You need to make sure that the gameobject the script is attached to has a Mesh-Renderer component with a material assigned and a Mesh-Filter with a mesh assigned.

Furthermore make sure the speed is set something other than 0 in the inspector for the texture to move.

The problem with the code is in line 9:

currentMaterial = gameObject.GetComponent<Renderer>().material;

use GetComponent<MeshRenderer>().material instead of renderer.material and also SetTextureOffset with capital ‘S’