# When key is pressed, play 2D. When key is not pressed, stop playing the sound.

**URL:** <https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856>\
**Category:** Audio\
**Tags:** footsteps, unreal-engine, question\
**Created:** [December 13, 2020, 9:07pm UTC](https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856 "2020-12-13T21:07:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![78rye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@78rye](https://forums.unrealengine.com/u/78rye)\
**Post date:** [December 13, 2020, 9:07pm UTC](https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856/1 "2020-12-13T21:07:26Z")

</div>

Hello! I am a recent beginner when it comes to Unreal Engine and need some help. So I made my own First Person Character and I want him to have footsteps. I thought I could just keep playing the footsteps sounds until the key is released. I saw that you can do it with animation but I don’t have any set up and I just want to work with audio. Does anyone have a simple way in which I can just play the sound (preferable looped), then stop when released.

Also if anyone can tell me how to pan the sounds once I hear them, that would be great too!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 13, 2020, 9:38pm UTC](https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856/2 "2020-12-13T21:38:33Z")

</div>

Easiest way is to use this:

> **[Niagara Footstep VFX in Visual Effects - UE Marketplace](https://www.unrealengine.com/marketplace/en-US/product/niagara-footstep-vfx)**
>
> 15 Niagara Footstep Particles That Will Take Your Game To The Next Level!

---

<div class="post-metadata">

**Author:** ![78rye](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@78rye](https://forums.unrealengine.com/u/78rye)\
**Post date:** [December 13, 2020, 10:48pm UTC](https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856/3 "2020-12-13T22:48:43Z")

</div>

and how do I use or what would I look up to know how to use the vfx? again, I’m a beginner

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [December 13, 2020, 11:02pm UTC](https://forums.unrealengine.com/t/when-key-is-pressed-play-2d-when-key-is-not-pressed-stop-playing-the-sound/475856/4 "2020-12-13T23:02:43Z")

</div>

You just get that asset ( it’s free ), it comes with instructions. It does everything, change footsteps sounds on different ground, doesn’t do steps when jumping etc.

EDIT: You can do what you’re asking like this. Inside the player:

 ![324708-screenshot-3.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/5/f/95f503612bd27ed65f5400da52c0d80f56d7e09e.jpeg)

and PlaySound looks like this:

 ![324709-screenshot-4.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/f/8/4f82905c418ed0ca044830e7561a435e6728bd19.jpeg)

You can see it’s already a bit of a fiddle, and will get worse as you add requirements like different sounds for different surfaces. That’s why I recommended the asset 😉
