How to trigger sound with hotkey on object

I wanna add an object so when I press E on it it will play a sound does anyone have a script?

If you have an audio source attached to a game object. Then you can attach the following script to the game object to make it play the sound:

function Update() {
 // Plays the attached audio file when you press Space
 if(Input.GetKeyDown(KeyCode.Space)) {
   audio.Play();
 }

}

if(Input.GetKeyUp(KeyCode.E))
{
var hit: RaycastHit;
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit) && hit.collider.tag == “yourObjectTag”)
{
//-------------------- Play sound ---------------------------
}
}