When i enter a trgger it create a game object Play a sound and when it end it destroy self

I am a beginner game creator and this what i want to do .but i totally not have any idea how can i do this so please help me .

There are several ways to do that. A popular approach is to check the entering object’s tag in OnTriggerEnter, so that only the player can activate the trigger, then create the object and play the sound (AudioSource attached to the trigger); check again in OnTriggerEnter if it’s the player, then destroy the object - example:

Trigger code:

var prefab: GameObject; // object prefab reference
private var obj: GameObject; // reference to the created object

function OnTriggerEnter(other: Collider){
  if (other.tag == "Player"){ // if the player entered the trigger...
    // create the object and get a reference to it:
    obj = Instantiate(prefab, transform.position, transform.rotation);
    // play the sound in the trigger AudioSource:
    audio.Play();
  }
}

function OnTriggerExit(other: Collider){
  if (other.tag == "Player"){ // when the player exits the trigger...
    if (obj) Destroy(obj); // kill the created object, if any
  }
}

NOTE: You must attach an AudioSource to the trigger object, and define the sound in its Clip field, in the Inspector.

Notice the if (obj) in OnTriggerExit: this avoids possible headaches case the object gets destroyed by other agent before the player exits the trigger.

EDITED: Ooops! Do you want the object to suicide when the sound finishes, not when the player leaves the trigger? This requires a different approach: just create the object in OnTriggerEnter, and wait for sound end inside the object script:

Trigger script:

var prefab: GameObject; // object prefab reference

function OnTriggerEnter(other: Collider){
  if (other.tag == "Player"){ // if the player entered the trigger...
    // just create the object:
    Instantiate(prefab, transform.position, transform.rotation);
  }
}

Object script:

function Start(){
  audio.Play(); // start the sound
  yield; // wait for next frame
  while (audio.isPlaying){
    yield; // repeat this loop while sound is playing
  }
  Destroy(gameObject); // suicide
}

NOTE: In this case, the AudioSource and the script above must be attached to the object prefab - define the sound in the AudioSource Clip property, in the Inspector. Clear the Play On Awake checkbox in the AudioSource, since there’s an audio.Play instruction in the script, or do the opposite: remove audio.Play and leave Play On Awake checked (just don’t let both active, since this can cause a glitch when the sound starts).