Destroy(gameObject) not working

I am trying to destroy the object that the script is attached to by calling this function from another script:

function Destroythis() {
print("destroy this object");
Destroy(gameObject);
}

The console did not show any errors and it did show “destroy this object”.

Fixed this problem. One of the functions in another script didn’t call the Destroythis function.

If you want to destroy object, to which this script attached you need to call
GameObject.Destroy(gameObject);