# Does anyone know why this isn't working

**URL:** https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410
**Category:** Help
**Created:** [March 8, 2025, 9:24pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410 "2025-03-08T21:24:19Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [March 8, 2025, 9:24pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/1 "2025-03-08T21:24:19Z")

</div>

I want to put a limit to how many sprite spawn when you overlap a sprite but its not working  
Here is link:

> **[Dragon Ball Meta Verse (Name work in progress) (Version 0.0.1)](https://arcade.makecode.com/S68572-11059-12107-04080)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

also picture:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/4/34fc1f1a186c3ffb94abd6a1b60b4f6c4462862a.png)

---

<div class="post-metadata">

### Author: ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)
#### Post date: [March 9, 2025, 5:21am UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/2 "2025-03-09T05:21:11Z")

</div>

you need to define the second instance of “value” as “value2” or just another name else the code gets confused if it’s referencing the sprites of kind _Bandit\_Spawn_ or the sprites of kind _Bandit_

---

<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: [March 9, 2025, 5:26am UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/3 "2025-03-09T05:26:01Z")

</div>

In this case, “value” is holding the _sprite_ in the array, not a number. You can fix this by setting a different number variable to 0 before the loop, changing it by 1 inside the loop, and only creating the Sprite if the number is less than 4, (or 5 if you change the number before you check if it’s less)

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [March 10, 2025, 4:55pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/4 "2025-03-10T16:55:35Z")

</div>

i tried somthing but im not sure it works well

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/e/6e663945ff1f6c3ac1ba918c740bd22dd07998ff.png)

---

<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: [March 10, 2025, 6:42pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/5 "2025-03-10T18:42:14Z")

</div>

This is good! There is one problem that I can spot…  
let’s say you touch an enemy and the random number you get is 3, so 3 bandits spawn. Then you touch another and the random number you get is 2. Now there’s a problem because “sprites” is now equal to 5, which is not 4, so next time you touch a bandit it does not prevent more from spawning. What you need to do is change the not-equal sign to a “\<” so that if “sprites” is greater than 4, no more can spawn!

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [March 28, 2025, 10:00pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/6 "2025-03-28T22:00:10Z")

</div>

Hello can you help with this

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

---

<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: [March 28, 2025, 11:01pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/7 "2025-03-28T23:01:42Z")

</div>

If you click the warning icon, does it tell you anything useful? If not, could you please send an updated link? ☺

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [March 29, 2025, 5:52pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/8 "2025-03-29T17:52:45Z")

</div>

it did so I tried some stuff to fix it but it still didn’t work  
Here’s the link:

> **[Dragon Ball Meta Verse (Name work in progress) (Version 0.0.1)](https://arcade.makecode.com/S68572-11059-12107-04080)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [May 9, 2025, 5:44pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/9 "2025-05-09T17:44:23Z")

</div>

hello 🙃 🙃

Can you help me I’m going to make a post about this soon but I’m trying to make games for people to get better at coding, but there’s something wrong with this and I don’t understand what it means

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/9/49bb8aff3500e60e29b07c61e3a19e12bb869428.png)

> **[Titan Slayer](https://arcade.makecode.com/S77275-60328-75533-41787)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [May 9, 2025, 5:46pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/10 "2025-05-09T17:46:52Z")

</div>

the menu sprite you make there is made from a list of options, but isn’t itself a list of options – basically, you can’t use a sprite as an array. If you want to do this, you’ll want to reorder to something like this:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/d/7da3f63d22ddcac58b8278c0ca2ba3e8b9e05813.png)  
making the list of options and updating it first, before passing it off when creating the menu sprite

---

<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: [May 10, 2025, 6:02pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/11 "2025-05-10T18:02:20Z")

</div>

@jwunderl beat me to it, but essentially “Character Select” is a Menu Sprite, and that sprite contains that item array. Like, the data looks like this:

Menu(array[…])

but you are trying to add items to the Menu instead of the array inside it. What @jwunderl has done is put the array into its own variable, like this:

Character Options = array[menu items…]

Menu = Create Menu With (Character Options)

And that lets you add menu items to the array before you create the menu. Just make sure you are adding the items before you create the menu, because adding them after won’t update the menu automatically.

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [May 10, 2025, 6:05pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/12 "2025-05-10T18:05:47Z")

</div>

nvm I did something else that seems to work  
i don’t know why but whenever I post a question my brain magically finds a solution which is just dumb and when i don’t post it my brain just stops and i never find the answer which makes no sense

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [May 13, 2025, 11:47pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/13 "2025-05-13T23:47:58Z")

</div>

Hello sorry for asking you to help me alot but can you help understand why this isn’t working

> **[Blue Lock Isagi test](https://arcade.makecode.com/S34489-35850-18362-97832)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I want to make it so that if your score is higher than your life by 5 you win and if your life is higher than your score by 5 you lose though this is just a test version of the main game I’m working on so I won’t be using scores or lives just status bars

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/6/e/6edc59f92143cf2564bc6e15a214ce379de77334.png)

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [May 13, 2025, 11:58pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/14 "2025-05-13T23:58:18Z")

</div>

also is this what your talking about

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/d/9/d9d52b2d6f0e1ca9dfe5b67247e9319940f90495.png)

---

<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: [May 14, 2025, 3:12am UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/15 "2025-05-14T03:12:25Z")

</div>

The best thing to do in these situations is to walk through an example situation and see if the math works out.

For example, what happens when your lives are the _same_ as your score, which shouldn’t make anything happen. Let’s say they are both 1. Now the first check is to see if “life” (1) is less than “score” (1) + 5. And would you look at that! 1 is indeed less than 1+5, so the first bit of code runs and you win!! But that’s not what we wanted to happen!

Now how do we make it right? It’s pretty simple. What we want to do is check if the score is above the life by 5. There are many ways to do this, but the simplest way with the code you already have is to turn those “+” operations into “-“ operations.

Now if our “score” is 6 and our life is 1, that should trigger the win. But… 6-5 is 1, and 1 is not less than 1! So you’ll also need to change that \< to a \<= (just imagine they are one character. You are looking for the “or equal” versions of the “less than” character)

Now it should work!

---

<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: [May 14, 2025, 3:13am UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/16 "2025-05-14T03:13:01Z")

</div>

You might need to move the code that adds to the array above the code where you create the menu sprite. I’m not entirely sure though, so if it works then you don’t have to change anything. If it isn’t working then that’s because the menu doesn’t update to show newly added elements, so you have to add the new elements before starting the menu by moving those “insert” blocks to be right under the first array block, before the “set (menu)” block

 ![IMG_8685](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/0/b0559b653de8cce32374bafbf127ae131874438e.jpeg)

---

<div class="post-metadata">

### Author: ![IceyDomain](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/iceydomain/32/18326_2.png) [@IceyDomain](https://forum.makecode.com/u/IceyDomain)
#### Post date: [May 15, 2025, 2:40pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/17 "2025-05-15T14:40:18Z")

</div>

😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/4/7464435ff2d219afd65dabe1571e0ad97bc1c551.png)

Where are all my variables and kinds

---

<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: [May 15, 2025, 2:51pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/18 "2025-05-15T14:51:46Z")

</div>

Yikes! Close and open Makecode, then try using the history feature to restore it. If you do restore it successfully, make sure to download the project to save it. Then maybe consider importing that save to create a new version of the project just incase the other one is bugged somehow. This is an issue that hasn’t been fixed because they can’t figure out why it’s happening!

---

<div class="post-metadata">

### Author: ![BlobDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobdev/32/25519_2.png) [@BlobDev](https://forum.makecode.com/u/BlobDev)
#### Post date: [May 15, 2025, 2:59pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/19 "2025-05-15T14:59:38Z")

</div>

You have to remake them all then convort to javascript, leave the code (while still in javascript) wait 15-20 mins come back and it wont happen again after yoou do that

---

<div class="post-metadata">

### Author: ![BlobDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobdev/32/25519_2.png) [@BlobDev](https://forum.makecode.com/u/BlobDev)
#### Post date: [May 15, 2025, 3:46pm UTC](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410/20 "2025-05-15T15:46:42Z")

</div>

Worked for me in my project

[Next page](https://forum.makecode.com/t/does-anyone-know-why-this-isnt-working/34410.md?page=2)
