# Sound keeps playing even after AI dead

**URL:** <https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178>\
**Category:** Audio\
**Tags:** unreal-engine, stop, loop, question\
**Created:** [April 24, 2020, 8:56am UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178 "2020-04-24T08:56:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yesh\_CJ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yesh\_CJ](https://forums.unrealengine.com/u/Yesh_CJ)\
**Post date:** [April 24, 2020, 8:56am UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/1 "2020-04-24T08:56:34Z")

</div>

I have created a event start fire after 0.4 seconds created another event stop fire and the audio also plays for 0.4 seconds.But before this 0.4 seconds if the pawn dies while firing it keeps on playing the sound

 ![300350-p2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/8/0/b8090cefb563663ee46d2267b442f9a1490e4a2a.png)

I tried different ways to solve this but all end in the same issue.

---

<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:** [April 24, 2020, 9:39am UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/2 "2020-04-24T09:39:59Z")

</div>

When you spawn the sound in the AI, attach it to a component in the AI like this:

 ![300449-sound.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/8/f/78fab6c02487387657607dfd99bc329f2c80661a.jpeg)

That way, when the AI dies, the component gets trashed and the sound stops playing.

---

<div class="post-metadata">

**Author:** ![Yesh\_CJ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yesh\_CJ](https://forums.unrealengine.com/u/Yesh_CJ)\
**Post date:** [April 24, 2020, 11:21am UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/3 "2020-04-24T11:21:58Z")

</div>

Yes now the sound stop when destroyed but now its spawning sound at different time.  
I don’t know whether I have connected nodes properly

 ![300457-p2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/4/3f41421950ed934531fc8fd417d2c603504f7884.png)

---

<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:** [April 24, 2020, 11:36am UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/4 "2020-04-24T11:36:37Z")

</div>

Your BP is very convoluted. All you need is something like:

 ![300466-sound.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/a/c/facc6c17cecf2872fd16fb517e534550219edf7e.jpeg)

---

<div class="post-metadata">

**Author:** ![Yesh\_CJ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yesh\_CJ](https://forums.unrealengine.com/u/Yesh_CJ)\
**Post date:** [April 24, 2020, 4:48pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/5 "2020-04-24T16:48:44Z")

</div>

Sorry I really don’t know what to do here because I can’t add component to this BP I cant even add an audio component or a mesh component here so I am am very much confused what is to be added to “attach to component”.

 ![300481-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/2/f/e2f0511a416ad18b12a853172937c0f47f856402.png)

 ![300482-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/8/3/b83c4d1a6411c62c580ecdf64dc6f15f7e93cd28.png)

---

<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:** [April 24, 2020, 4:56pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/6 "2020-04-24T16:56:16Z")

</div>

I can see it’s a blueprint and you can always put components in a blueprint. It doesn’t matter what it is, a scene is good because it doesn’t show anything:

 ![300483-addcomponent.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/1/0/b10874375266b7288eb6ad6cd62ca240c9ec84ef.jpeg)

---

<div class="post-metadata">

**Author:** ![Yesh\_CJ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yesh\_CJ](https://forums.unrealengine.com/u/Yesh_CJ)\
**Post date:** [April 24, 2020, 6:47pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/7 "2020-04-24T18:47:19Z")

</div>

In this image it’s not

 ![300498-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/3/6/d36acafb010eb87092311d25f4f2050b345b7b6b.png)

show anything like add component.  
Its showing only “Add new”. I created this only for black board to tell AI when to start shoot and when to stop

---

<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:** [April 24, 2020, 6:57pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/8 "2020-04-24T18:57:15Z")

</div>

But I see you spawned and attached a sound in your picture above:

![300501-spawn.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/6/4/064824e3cc3487e57ad5d94d1ba4ea4818856ee6.jpeg)

Just like that, but you don’t need all these extra nodes like start fire and stop fire, because the main node is being called, that’s all you need.

---

<div class="post-metadata">

**Author:** ![Yesh\_CJ](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yesh\_CJ](https://forums.unrealengine.com/u/Yesh_CJ)\
**Post date:** [April 24, 2020, 7:34pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/9 "2020-04-24T19:34:39Z")

</div>

Hi ClockworkOcean,  
Thanks a lot for helping. Sorry I am an amateur that’s why I was confused a lot in this.  
Now everything is working perfectly well.

![300512-perfect2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/1/c/21cd6d4569faf913233c1607fa0192bf83f31b68.png)

---

<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:** [April 24, 2020, 8:16pm UTC](https://forums.unrealengine.com/t/sound-keeps-playing-even-after-ai-dead/464178/10 "2020-04-24T20:16:22Z")

</div>

I’m glad it works! I see the problem now, you were missing your components window, but I see you found it 🙂
