how to disable a script when object has a child

I need help disabling the script of the parent when a child is Instantiated?

void Start()
{
if (transform.parent != null)
{
transform.parent.GetComponent().enabled = false;
}
}

To destroy it:

 void Start()
    {
            if (transform.parent != null)
            {
                Destroy(transform.parent.GetComponent<SCRIPTNAME>());
            }
    }