Need help with NullReferenceException

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class abrirPuerta : MonoBehaviour
{

    public Text abrirPuertaText;
    public Animator puerta;
    private bool show;
    public AudioClip button;
    public AudioClip door;
    private AudioSource audioSetup;
   
    void Start()
    {
        abrirPuertaText.text = "";
        show = false;
        puerta.SetBool("on", false);
        audioSetup = GetComponent<AudioSource>();
    }

    private void Update()
    {
        if (show)
        {
            abrirPuertaText.text = "Pulsa 'E' para abrir la puerta.";
        }
        else
        {
            abrirPuertaText.text = "";
        }

        if (Input.GetKeyDown(KeyCode.E) && show == true && puerta.GetBool("on") == false)
        {
            audioSetup.clip = button;
            audioSetup.Play();
            audioSetup.clip = door;
            audioSetup.Play();
            puerta.SetBool("on", true);
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.E) && show == true && puerta.GetBool("on") == true)
            {
                audioSetup.clip = door;
                audioSetup.Play();
                puerta.SetBool("on", false);
            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            show = true;
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.tag == "Player")
        {
            show = false;
        }
    }
}

I dragged the animations, text, audio etc and still not working dunno why because it was working but now even with ctrl+z wont work anymore :S

Immediately prior to line 18, use debug.log() to print out the name of the GameObject and see if maybe there is another instance of your script on another GameObject.

 Debug.Log( name);

Well, the error claims abrirPuertaText(line 18 and 32) is null. So make sure you have something in the text field in the inspector. Also, make sure you don’t have a second copy of the script in your scene.

Oh all my prefs had the same script attached I didnt know they couldn’t all have it :S, they are control panels that open a door in front of them(diferent doors)

You can reuse a script if needed, but if you have multiple copies and you are accessing variables, every copy of the script needs to have something in those variables. Filling in the variables on one script through the inspector isn’t going to fill in the other copies. Otherwise, you’ll need to do null checks to avoid trying to access variables that are null.

But, if you are trying to reuse parts of the script but don’t need other parts, it’s probably better to create two scripts at that point. Or look into inheritance.