Level times out and no code is executed. Any help appreceated
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);