SetActive for a sertain time?

Hello i want to set up some text im my game so when i enter a serain trigger it should be visable but after like 2 or 3 secounds it should be invisable again. How do i manage this?

USING JAVA

My code:
#pragma strict

var Text1 : GameObject;

function Start () 
{
	Text1.SetActive(false);
}

function OnTriggerStay (other : Collider) 
{
	if(other.tag == "Player")
	{
		Text1.SetActive(true);
		Destroy(gameObject, 1.5);
	}
}

TriggerStay is called all the time for as long as there is some interaction.
Instead try the simplest thing of using a small function with yield waitforseconds.

function WaitForMe(){
   Text2.SetActive(true);
   yield WaitForSeconds(secondsToWait);
   Text2.SetActive(false);
}

Call that through

function OnTriggerEnter(col:Collider){
   if(col.CompareTag("Player") ){
     WaitForMe( how many seconds you want here );
   }
}

Don’t forget to declare the seconds variable at the beginning of the script.
You’ll be able to put the seconds through the editor instead of changing and compiling the script.