Disabling a script using another script (Different game objects)

I want to disable a script attached to a camera using a script attached to the player

using UnityEngine;
using System.Collections;

public class MainRestart : MonoBehaviour {

    private BlockSizeAndPosition DisableSpawningBlocks;
    private PlayerMovement DisablePlayerMovement;
    private MainRestart ThisScript;

    public GameObject DisableCameraFollow;

    void Awake() {
        DisableSpawningBlocks = GetComponent<BlockSizeAndPosition>();
        DisablePlayerMovement = GetComponent<PlayerMovement>();
        DisableCameraFollow = GetComponent<CameraFollow>();
        ThisScript = GetComponent<MainRestart>();
        DisableCameraFollow = GameObject.FindWithTag ("MainCamera").GetComponent<CameraFollow>(); //I'm trying to get the CameraFollow script using this line
    }

    void OnTriggerEnter2D(Collider2D OtherObject) {
        if(OtherObject.gameObject.CompareTag("Enemy")) {
            DisableSpawningBlocks.enabled = false;
            DisablePlayerMovement.enabled = false;
            DisableCameraFollow.enabled = false; //It won't let me use the "enabled"
            Destroy (gameObject);
            ThisScript.enabled = false;
        }
    }

    void Update() {
        if (transform.position.x > 2.62f || transform.position.x < -2.62f) {
            DisableSpawningBlocks.enabled = false;
            DisablePlayerMovement.enabled = false;
            DisableCameraFollow.enabled = false; //Same problem with "enabled" here
            Destroy (gameObject);
            ThisScript.enabled = false;
        }
    }

}

I’m not sure but it might be because you try to get the object on Awake, maybe the object is inactive in the beginning ? Just to test it, put your line where you get the CameraFollow component, on Start. And then :

Debug.Log(DisableCameraFollow);

Do this, just so that we can see if the component is null or not.

I tried it but I’m getting these errors (got it also before trying what you said just forgot to mention):

Couldn’t you do

WantedObj.GetComponent<WantedScript>().enabled=false;

?

What do you want to do as opposed to that? All you asked was for how to disable a script with another one