Getcomponent<script>() returns null NO MATTER what i do

ive been working on thisa for like 3 days straight

if(Input.GetAxis("Fire1") > 0)
        {
            Debug.Log("fire1");
            
            if(Physics2D.Raycast(trans, InputDirection, RayDist,layerMask))
            {
                Debug.Log("raycast");
                RaycastHit2D HIT = Physics2D.Raycast(trans, InputDirection, layerMask);
                Debug.Log(HIT.collider.gameObject);
                GameObject HitGameObject = HIT.collider.gameObject;
                Debug.Log(HitGameObject.GetComponent("Dialogue"));
                if(HIT.collider.GetComponent<Dialogue>() != null)
                {
                    Dialogue i_Ctrl = HIT.collider.GetComponent<Dialogue>();

                    Array Diags = i_Ctrl.DialogueArr;

                    Array ChaIf = i_Ctrl.characterInfos;
                    Debug.Log("got arrays");
                    UI.StartDialogue(Diags, ChaIf);
                    
                }
                
            }
        }

i have tryed getting the script from the collider HIT.collider.GetComponent();
i have tryed getting the game object then trying to grab the script from the game object
GameObject HitGameObject = HIT.collider.gameObject;
Debug.Log(HitGameObject.GetComponent(“Dialogue”));

IT IS
on the correct object
active in the scene
file name is named the same as the class
timing is not the problem

the problem IS the ()part of the script i can get transforms and other components easily just not the script

help PLEASE TvT

If GetComponent is returning null then the object does not have that component on it. You must have an incorrect assumption somewhere.

Add the context parameter to your log (the second input to Debug.Log):
Debug.Log(HIT.collider.gameObject, HIT.collider.gameObject);
When you click on the log in the Console window the object will be pinged in the Hierarchy window. Select the object that was pinged, and if it has the component send a screenshot of it and reply here.

Also note that:

if(HIT.collider.GetComponent<Dialogue>() != null)
{
     Dialogue i_Ctrl = HIT.collider.GetComponent<Dialogue>();

can be replaced with:

if (HIT.collider.TryGetComponent(out Dialogue i_Ctrl))
{

thank you!
the raycast was hitting the player because it originates from the player!!