Telling another object to do something

Hello. This question might sound dumb but please help me if you can :slight_smile: . In this javascript:

function OnTriggerEnter () {
	GameObject.Find("Fence"){
		Destroy (other.gameObject);
	}
}

I am trying to make it so whenever a “cube” touches a “key” the “key” game object will find another object named “Fence” and destroy it. What am I doing wrong here? Someone please provide me with a proper script to do what I wanted.

BTW: My knowledge to javascript is very limited so the next time I ask a question like this one, remember I am still a beginner.

maybe something like

function OnTriggerEnter () {
   var destroyMe = GameObject.Find("Fence");
    Destroy (destroyMe); 
}

Thanks Bjerre :smile:. It worked!