how do I disable a script

I wanted to stop two of my scripts when I enterd a trigger. One of the got disabled but the other one didn’t.
This is the one that did not get disable:

using System.Collections;

using UnityEngine;

using UnityEngine.UI;

using System.Collections.Generic;

public class Timer : MonoBehaviour
{

public Text timerTxt;

public float startTime;

// Use this for initialization
void Start () {
	startTime = Time.time;
}

// Update is called once per frame
void Update () {
	float t = Time.time - startTime;

	string minutes = ((int)t / 60).ToString	();
	string seconds = (t % 60).ToString();
	timerTxt.text = minutes + seconds;	
}

}

The one that did:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
public Rigidbody rB;

public float movementSpeed;

public float turnSpeed;

public float brakeSpeed;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void FixedUpdate () {
	Movement ();
}
public void Movement()
{
	rB.AddRelativeForce (Vector3.right * movementSpeed);	

	if (Input.GetKey("s"))
	{
		rB.AddRelativeForce(Vector3.left * brakeSpeed);
	}

	if (Input.GetKey ("d")) {
		rB.AddRelativeForce (Vector3.back * turnSpeed);

	}
	if (Input.GetKey ("a")) {
		rB.AddRelativeForce (Vector3.forward * turnSpeed);
	}
	if (Input.GetKey("s"))
	{
		turnSpeed = 15f;
	}
}

}

I also filled in all the objects etc.

what funtion you used for disable those scripts?
I think best 2 ways to do this:
(1) Have a static bool to control it.
put this bool in xxx script, for example:
public static bool disableScripts=false;

Then add a line in update() of those 2 scripts:
if(xxx.disableScripts)this.enable=false;

(2) Use SendMessage to do it. So you will add a void in those 2 scripts:
void CloseMe(){
this.enable=false;
}
Then send message to the gameobjects which has those scripts attached.
xxxx.SendMessage(“CloseMe”);

ja these are the ones that should get disabled they are not the scripts that disable. The first one did not get disabled but the second one did

I can’t relate your code to the question but you can disable a script Component or a GameObject by setting enabled to false. ‘gameObject’ is the GameObject that the script is attached to.

var myScript = gameObject.GetComponent<MyScript> ();
myScript.enabled = false;