How would I play a sound on the player that presses F4?

So I have an F4 menu set up and it works to my needs. I would like to know how I can play a sound to the player that opens the menu.

I already tried doing this:

sound.Play( “mysound.wav”, vPos )

  1. Where do i put the .MP3 or .WAV i want players to hear in my gamemode folder? Where do i make the sound folder?

  2. Is there a way i can make it so it only plays the sound when they open it, but not close it?

  3. How would i target the player that hit F4, and not the vPos?

If you need me to explain more, please reply. Thank you.

  1. content/sound (if no folder create one)
  2. I assume you have when they press F4 it opens the menu, so just when it is created play the sound with surface.PlaySound
  3. Elaborate.

Assuming I’ve correctly understood what you mean:

  1. sound.Play will play a sound from a specified position in the world. This means that if you use it, others players near the position will be able to hear it as well so it’s not really just playing it to the player pressing f4. Instead, I suggest using surface.PlaySound( soundfile ) http://wiki.garrysmod.com/page/surface/PlaySound which will play a sound directly on the client.