# Destroy Actor on Key Pressed

**URL:** <https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675>\
**Category:** Editor Scripting\
**Tags:** actor, inventory, unreal-engine, question, items\
**Created:** [May 5, 2020, 4:36am UTC](https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675 "2020-05-05T04:36:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FunnyGuy9796\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunnyGuy9796\_1](https://forums.unrealengine.com/u/FunnyGuy9796_1)\
**Post date:** [May 5, 2020, 4:36am UTC](https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675/1 "2020-05-05T04:36:03Z")

</div>

Hello, I am trying to make an inventory system and so far it is going fairly well. Although, I am having some trouble make a collectible item. I already have everything else set up, I’m just wondering if there is any way I can destroy an actor when the player presses a key or controller button. Thanks in advance.

---

<div class="post-metadata">

**Author:** ![MkMike001](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MkMike001](https://forums.unrealengine.com/u/MkMike001)\
**Post date:** [May 5, 2020, 8:00am UTC](https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675/2 "2020-05-05T08:00:34Z")

</div>

What about calling Actors Destroy Method on an input event. If you already know which actor to destroy you can call its DestroyActor node on a keypress. Try bellow node to capture a key event on UMG

![301243-listenforinputaction.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/1/2/812f45dc7fa6ed317bb12bbaf0d95a9a9ea23c9f.png)

---

<div class="post-metadata">

**Author:** ![FunnyGuy9796\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunnyGuy9796\_1](https://forums.unrealengine.com/u/FunnyGuy9796_1)\
**Post date:** [May 7, 2020, 7:18am UTC](https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675/3 "2020-05-07T07:18:47Z")

</div>

I’ve tried using DestroyActor by following almost all the tutorials I could find but it doesn’t work for some odd reason.

---

<div class="post-metadata">

**Author:** ![FunnyGuy9796\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FunnyGuy9796\_1](https://forums.unrealengine.com/u/FunnyGuy9796_1)\
**Post date:** [May 7, 2020, 7:25am UTC](https://forums.unrealengine.com/t/destroy-actor-on-key-pressed/464675/4 "2020-05-07T07:25:47Z")

</div>

I finally found the answer! I was able to use a node that enabled input for the actor component, linked that to an input event and then destroyed the actor when that event was triggered.

 ![301287-item-5-5-2020-1-35-11-pm.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/1/1/51185426ea714c8458f7da8e246561a4b86dc705.png)
