Game not behaving as I scripted.

Firstly, I wrote a code for a button:

function Update () {
    if(Input.touchCount < 1){
    GameObject.Find("Shape").GetComponent(ChangeSprite).enabled = true;
    else {
    GameObject.Find("Shape").GetComponent(ChangeSprite).enabled = false;

so when you touch it it would activate the other script:

var diamond : Sprite;
     var circle : Sprite;
     var triangle : Sprite;
     var square : Sprite;
     private var number : int;
     private var spriteRenderer : SpriteRenderer;
    function Start () {
    number = Random.Range(1,4);
    if(number == 1) {
    spriteRenderer.sprite = diamond;
    else if(number == 2) {
    spriteRenderer.sprite = circle;
    else if (number == 3) {
    spriteRenderer.sprite = triangle;
    else {
    spriteRenderer.sprite = square;

This script is on an empty object. What the code does is it changes the sprite image of the game object. But it doesn’t recognise my touch. and i get an error saying : “NullReferenceException: Object reference not set to an instance of an object
ChangeSprite.Start () (at Assets/Scripts/GAME/ChangeSprite.js:23)” every time i hit the play button. Is there anything wrong with my code? I’m new to unity. Please help me. Thanks in advance.

You probably need to set the spriteRenderer variable to the SpriteRenderer component of the object.

i’m not sure about your code but did you remember to drag all the sprite images to there matching variable in the inspector?