What i am trying to do is if my player get the key , i want the door open by walking on italt text
Not sure how your door is setup, but maybe something like this will work?
if(other.tag == "key1"){
Destroy(other.gameObject);
key1obtained = true;
}
if(other.tag == "door1" && key1obtained){
other.gameObject.GetComponent<DoorScript>().Open();
}