How to activate a script on multiple objects, but only on that object

So I am making a game that has multiple objects that have the same script. How do I have only one of those activate one at a time instead of activating them all at once? Right now I have,
RaycastHit hit;

    if (Physics.Raycast(cam.transform.position, cam.transform.forward, out hit, range))
    {
        if (hit.transform.tag == "door")
        {

            crosshair.enabled = false;
            doorPanel.SetActive(true);
        }

        if (Input.GetKey("e"))
        {
            if (hit.transform.GetComponent<doorHandler>() != null)
            {
                hit.transform.GetComponent<doorHandler>().Clean();
            }
        }

        else if(Input.GetKeyUp("e"))
        {
            Debug.Log("e is up");
            Debug.Log("Disabling Slider");
            hit.transform.GetComponent<doorHandler>().cleanSliderGO.SetActive(false);
            
        }
    }
    else
    {
        doorPanel.SetActive(false);
        crosshair.enabled = true;

    }
    
}

what this ends up doing is activating the doorHandler script on every door instead of just the one that I’m looking at. How do I only activate the script of the one that I’m looking at? A real issue that this causes, is that I have text that is affected based on the clean() script. Even when I move from door to door, the text doesn’t change until I activate the script by pressing E. Please help!

Good day.

Whats the problem with your code below? does the code enters in all “if” when is necessary? or whichones doesnt enter?

at the firstone, when you say:

         crosshair.enabled = false;
         doorPanel.SetActive(true);

How the code knows what doorPanel mus activate? maybe you forget to make the relation hit-doorpanel?

Give more info of what you have what you get what you don’t and what it was suposed to be…

Thanks and bye!