NullReferenceException: Object reference not set to an instance of an object

Hello there. I have problem with this code.
It says NullReferenceException: Object reference not set to an instance of an object at line 25. In inspector I have attached script to game object. It works for player 1 but for player 2 not. If I manually increase score of second player it works but it seems like script is not getting score from script SimplePlatformController2. Can you help me?

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class Score : MonoBehaviour {
  
    private SimplePlatformController controll;
    private SimplePlatformController2 controll2;
    public int count11;
    public int count22;
    public Text WinText;
   


    // Use this for initialization
    void Awake () {
        controll = GetComponent<SimplePlatformController>();
        controll2 = GetComponent<SimplePlatformController2>();
        

    }

    // Update is called once per frame
    void Update () {
        count11 = controll.count1;
        count22 = controll2.count2;
    }

    public void OnTriggerEnter2D(Collider2D other)
    {


        if (other.gameObject.CompareTag("Finish"))
        {
            other.gameObject.SetActive(false);
            GameOver();
        }
    }

    void GameOver()
    {
       
        if (count11 > count22)
        {
            SceneManager.LoadScene(3);
        }
        else if (count22 > count11)
        {
            SceneManager.LoadScene(4);
        }

    }


}

the problem is you’re calling

     count11 = controll.count1;
     count22 = controll2.count2;

in update, and both your player and player2 only have one of the scripts, so one of the counts is null on both players.

You can fix this by adding:

if (controll != null)
     count11 = controll.count1;
if (controll2 != null)
     count22 = controll2.count2;

Perhaps all in all, it’s better if you add the score script to 1 empty gameobject, and make the fields controll and controll2 public and assign them in the inspector instead of assigning the score script to both players.

This way it will fix your problem too and it will be cleaner.
If you do go for this way don’t forget to remove the awake method.