# \[SOLVED\] Help on level Dangerous Key

**URL:** <https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646>\
**Category:** Level Help\
**Created:** [January 15, 2021, 3:06am UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646 "2021-01-15T03:06:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![help](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@help](https://discourse.codecombat.com/u/help)\
**Post date:** [January 15, 2021, 3:06am UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/1 "2021-01-15T03:06:31Z")

</div>

Level times out and no code is executed. Any help appreceated

```python
function onHear(event) {
    // The pet can find the paladin and keys.
    var paladinUnit = pet.findNearestByType("paladin");
    var goldKey = pet.findNearestByType("gold-key");
    var silverKey = pet.findNearestByType("silver-key");
    var bronzeKey = pet.findNearestByType("bronze-key");
    // If event.speaker is paladinUnit:
    if (event.speaker == paladinUnit) {
       if (event.message == "Gold") {
           pet.fetch(goldKey);
       } 
       if (event.message == 'Silver') {
           pet.fetch(silverKey);
       }
       if (event.message == 'Bronz') {
           pet.fetch(bronzeKey);
       }
    }       
}

pet.on("hear", onHear);

```

---

<div class="post-metadata">

**Author:** ![Monsty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/monsty/32/20923_2.png) [@Monsty](https://discourse.codecombat.com/u/Monsty)\
**Post date:** [January 15, 2021, 3:21am UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/2 "2021-01-15T03:21:57Z")

</div>

Hello and welcome to the forum @help! 🥳

To format your code properly, please press the **\</\>** button  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/codecombat/original/3X/0/a/0a3107f0d80a2e94f11dbb06aae75c8bf5e0feea.png)

after you format press the button and put your code inside, it should look like this:

```python
// This is an example

```

could you send a link to the level please @help?

---

<div class="post-metadata">

**Author:** ![Monsty](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/monsty/32/20923_2.png) [@Monsty](https://discourse.codecombat.com/u/Monsty)\
**Post date:** [January 15, 2021, 3:25am UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/3 "2021-01-15T03:25:47Z")

</div>

> [@help](#):
>
> Bronz

It should be `'Bronze'`. Watch out for spelling errors 😁

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [January 15, 2021, 12:39pm UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/4 "2021-01-15T12:39:47Z")

</div>

Hi @help can you please post your new and updated code

---

<div class="post-metadata">

**Author:** ![help](https://avatars.discourse-cdn.com/v4/letter/h/ecae2f/32.png) [@help](https://discourse.codecombat.com/u/help)\
**Post date:** [January 15, 2021, 2:16pm UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/5 "2021-01-15T14:16:21Z")

</div>

Dam haha. That worked, thanks for your help!

---

<div class="post-metadata">

**Author:** ![milton.jinich](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/milton.jinich/32/21419_2.png) [@milton.jinich](https://discourse.codecombat.com/u/milton.jinich)\
**Post date:** [January 15, 2021, 2:17pm UTC](https://discourse.codecombat.com/t/solved-help-on-level-dangerous-key/26646/6 "2021-01-15T14:17:00Z")

</div>

congrats on completing the level
