# I need help , my sprite wont be destroyed on contact

**URL:** <https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130>\
**Category:** Help\
**Created:** [November 10, 2023, 6:24pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130 "2023-11-10T18:24:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![glitch1](https://avatars.discourse-cdn.com/v4/letter/g/f4b2a3/32.png) [@glitch1](https://forum.makecode.com/u/glitch1)\
**Post date:** [November 10, 2023, 6:24pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130/1 "2023-11-10T18:24:14Z")

</div>

so basically what I did what make it so that when my projectile makes contact with the player it gets destroyed but then I realised that It picks a random one to destroy instead of the one that touches the player, how to fix

---

<div class="post-metadata">

**Author:** ![Mega0star01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mega0star01/32/14784_2.png) [@Mega0star01](https://forum.makecode.com/u/Mega0star01)\
**Post date:** [November 10, 2023, 8:29pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130/2 "2023-11-10T20:29:42Z")

</div>

i don’t know, but hi, welcome to the community of makecode arcade.

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [November 14, 2023, 5:07pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130/3 "2023-11-14T17:07:11Z")

</div>

If you use the  
(on (sprite) of kind (player) touches (other sprite) kind (projectile)  
Block, you should be able to drag (othersprite) red bubble to the destroy block.

---

<div class="post-metadata">

**Author:** ![ADM\_F](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/adm_f/32/19808_2.png) [@ADM\_F](https://forum.makecode.com/u/ADM_F)\
**Post date:** [November 14, 2023, 5:08pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130/4 "2023-11-14T17:08:32Z")

</div>

First Welcome To the Makecode Comunity

Second Here is a small game with your problem fixed and here is how

> **[Sprite Go KABOOM](https://arcade.makecode.com/S06364-69787-74701-89942)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I belive the problem is that when you destroyed the projectile you didn’t destroy the one on it used the newest version of that variable (The newest bullet) NOT the one overlapping with the Sprite

The Bottom one is the one you need

and the Top is the glitched one

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c196711f2e8ba6cf46367b3e4bddf23a6efaa918.png)

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [November 14, 2023, 5:08pm UTC](https://forum.makecode.com/t/i-need-help-my-sprite-wont-be-destroyed-on-contact/24130/5 "2023-11-14T17:08:48Z")

</div>

its not a random one its the latest one  
this is a common error when you start or never really use such blocks  
what you did here was you used the sprite it self and not the one in the function

insted of using the sprit it self like this  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4b52bf57eb8765e6bf1f5a2aa1ff865c99d137fc.png)  
use the variable in your function like so  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/abebf6a0f071767d91ce1e2a6adb7f3cbe2e3aeb.png)  
when you create more then one sprite with the same variable when you try to make it do something it only applies to the last one you created
