how can i disable a script after a collision,how can i disable a script after a collision?

as i said i’m not able to create a script that say if my player hit a block (tagged with obstacle) it will disable PlayerMov, i searched many videos and tutorials but nothing, all was outdated and im not able to use it,as i said i’m not able to disable a script after a collision… i searched on internet some tutorials but all i found is now outdated and unity don’t compile it

add this script to your player. i didn’t test it but it should work fine;

public bool disablePlayerScript;
   private PlayerMov pm;

  void Start(){
   pm = this.GetComponent ();

void OnCollisionEnter(Collision col){
  if(col.transform.tag == "obstacle"){
    disablePlayerScript = true;
  } else{
    disablePlayerScript = false;

void Update(){
  if(disablePlayerScript == true){
  pm.enabled = false;   //this disables your PlayerMov script
  } else {
    pm.enabled = true;