# Problem with On Block Broken

**URL:** <https://forum.makecode.com/t/problem-with-on-block-broken/5173>\
**Category:** Minecraft\
**Created:** [December 21, 2020, 4:59pm UTC](https://forum.makecode.com/t/problem-with-on-block-broken/5173 "2020-12-21T16:59:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![diogodasilva](https://avatars.discourse-cdn.com/v4/letter/d/ed8c4c/32.png) [@diogodasilva](https://forum.makecode.com/u/diogodasilva)\
**Post date:** [December 21, 2020, 4:59pm UTC](https://forum.makecode.com/t/problem-with-on-block-broken/5173/1 "2020-12-21T16:59:27Z")

</div>

Hey everyone,

First post here, wondering if you can help me out. I’m coding an activity where students mine blocks that are stored in an array. Subsequently, when they use a stick, the array is depleted. All that is good.

I want to set a “target” variable to hold the kind of block they must mine, either using the BLOCK block (:D) or the “block by id”.

Problem: Makecode assumes that “On block broken (target)” comes before “on start” and issues an error.

 ![problem](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/7/703b0f0fae544ad1af1f45f40a7ec1e8f1ab3764.png)

I was able to get a workaround by basically moving the “on block broken” to someplace after the initialization of target, but this has to be done every time the code runs.

 ![solution](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1c7d956972a0e581a9caae0330f92549a9f4b2b5.png)

Does anyone know of a solution for this? It’s not a major issue, but it is kind of annoying :D.

Thank you all

Anyone know of a

---

<div class="post-metadata">

**Author:** ![Agent\_14](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/agent_14/32/17567_2.png) [@Agent\_14](https://forum.makecode.com/u/Agent_14)\
**Post date:** [December 23, 2020, 4:54pm UTC](https://forum.makecode.com/t/problem-with-on-block-broken/5173/2 "2020-12-23T16:54:36Z")

</div>

This is probably a bug. Maybe submit it here:

> [@Need help? Ask us anything! \[CLOSED\] \[12/21/2020 - 1/8/2021\]](https://forum.makecode.com/t/need-help-ask-us-anything-open-12-21-2020/5189):
>
> Do you have a BURNING question that you want an answer for from the MakeCode team??? Or just chill questions? Any question, all questions will do! Ask them here and we will answer it live [on stream!](https://www.twitch.tv/msmakecode) We’re going to try to post a new thread for each time we’ll run the segment! When we have enough questions to fill an hour we’ll answer them in one stream, and I’ll reply to this thread when it’s going to happen slight_smile This is still new though, so we’re still workshopping it / trying to find…
