# How to add a chance of something to spawn

**URL:** <https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909>\
**Category:** Help\
**Created:** [November 16, 2021, 4:58pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909 "2021-11-16T16:58:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Evan1](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@Evan1](https://forum.makecode.com/u/Evan1)\
**Post date:** [November 16, 2021, 4:58pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909/1 "2021-11-16T16:58:35Z")

</div>

Nov 16, 2021 - Hey guys, so im making a code which i will link below where you have to collect eggs, but i wanted to add something extra. So, every time you collect an egg, you get 1 point, but i wanted to add Golden Egg which would give you 5, but with only a 10% chance of spawning after collecting a previous egg. You will understand better if you play the game, if anyone can help me make that of send a screenshot.

Tysm, hope someone can help

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [November 16, 2021, 5:42pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909/2 "2021-11-16T17:42:47Z")

</div>

Welcome, @Evan1 !

You could do something like this:

 ![arcade-screenshot](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/694ac733d41bfa9cae3c333365a8dd9d62188dee.png)

The `% chance` block is in the **Math** drawer in the toolbox.

I created two different kinds for the sprites, _Egg_ and _SuperEgg_. That way, you could handle them differently when needed. For example, since you want to assign different points to the sprites, you could use two different `on sprite overlap` event handlers.

Let us know if you need additional help.

---

<div class="post-metadata">

**Author:** ![oofie1st](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@oofie1st](https://forum.makecode.com/u/oofie1st)\
**Post date:** [February 22, 2024, 10:22pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909/3 "2024-02-22T22:22:55Z")

</div>

Hello so i cant seem to find the chance block in Math, is there a problem with my makecode or is there an extension i have to add

---

<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:** [February 23, 2024, 7:09pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909/4 "2024-02-23T19:09:48Z")

</div>

On my phone it is the last block in the Math section. All the way at the bottom. You can also try searching for it with the search box at the top of the category list thing.

---

<div class="post-metadata">

**Author:** ![Sonicblaston](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sonicblaston/32/19164_2.png) [@Sonicblaston](https://forum.makecode.com/u/Sonicblaston)\
**Post date:** [February 23, 2024, 10:38pm UTC](https://forum.makecode.com/t/how-to-add-a-chance-of-something-to-spawn/10909/5 "2024-02-23T22:38:24Z")

</div>

Hello @oofie1st it should just be the bottom block in the math section. Send a screenshot if you can’t find it
