so i was making an RPG and i made it so that when i was killing zombies i would get exp and money but randomly it wil stop saying that u got exp or money , the last thing it says is the amount of exp then it stop saying anything please help.
this is the code :
let EXP = 0
let money = 0
let said = 0
let level = 0
player.onItemInteracted(CARROT, function () {
if (blocks.testForBlock(BLACK_CONCRETE, pos(0, 0, 1))) {
gameplay.title(mobs.target(LOCAL_PLAYER), "tutorial completed", "and the end of the game because im stil working on it")
}
})
mobs.onMobKilled(PIG, function () {
EXP += 5
player.say(EXP)
player.say("exp")
money += 10
player.say(money)
player.say("money")
})
loops.forever(function () {
if (blocks.testForBlock(BLACK_CONCRETE, pos(1, 0, 0))) {
player.teleport(world(121, 111, 340))
}
if (blocks.testForBlock(BLACK_CONCRETE, pos(0, 0, -1))) {
player.teleport(world(107, 111, 347))
}
if (blocks.testForBlock(PLANKS_ACACIA, pos(0, -1, 0))) {
mobs.spawn(mobs.monster(ZOMBIE), randpos(
world(104, 111, 361),
world(110, 111, 372)
))
loops.pause(3000)
}
if (blocks.testForBlock(PLANKS_SPRUCE, pos(0, -1, 0))) {
mobs.spawn(PIG, randpos(
world(104, 111, 361),
world(110, 111, 372)
))
loops.pause(3000)
}
if (EXP > 9 && EXP < 14 && said == 0) {
player.say("u leveled up. level 2")
level += 1
gezegt += 1
}
if (EXP > 19 && (EXP < 24 && said == 1)) {
player.say("u leveled up. level 3")
level += 1
gezegt += 1
mobs.applyEffect(HASTE, mobs.target(LOCAL_PLAYER), 600, 1)
}
if (EXP > 49 && (EXP < 54 && said == 2)) {
player.say("u leveled up. level 4")
level += 1
gezegt += 1
}
if (EXP > 79 && (EXP < 84 && said == 3)) {
player.say("u leveled up. level 5")
level += 1
gezegt += 1
}
if (EXP > 99 && (EXP < 104 && said == 4)) {
player.say("u leveled up. level 6")
level += 1
gezegt += 1
mobs.applyEffect(SPEED, mobs.target(LOCAL_PLAYER), 600, 1)
}
if (blocks.testForBlock(RED_CONCRETE, pos(1, 0, 0))) {
player.teleport(world(127, 110, 357))
while (true) {
if (blocks.testForBlock(LIME_CONCRETE, pos(0, -1, 0))) {
money += -50
if (money >= 0) {
mobs.give(
mobs.target(LOCAL_PLAYER),
WOODEN_SHOVEL,
1
)
player.teleport(world(107, 111, 357))
break;
} else {
player.say("je hebt niet genoeg geld")
player.teleport(world(107, 111, 357))
money += 50
break;
}
}
if (blocks.testForBlock(RED_CONCRETE, pos(0, -1, 0))) {
player.teleport(world(107, 111, 347))
break;
}
}
}
if (blocks.testForBlock(ORANGE_CONCRETE, pos(0, 0, 1))) {
player.teleport(world(127, 110, 357))
while (true) {
if (blocks.testForBlock(LIME_CONCRETE, pos(0, -1, 0))) {
money += -100
if (money >= 0) {
mobs.give(
mobs.target(LOCAL_PLAYER),
WOODEN_PICKAXE,
1
)
player.teleport(world(107, 111, 347))
break;
} else {
player.say("je hebt niet genoeg geld")
player.teleport(world(107, 111, 357))
money += 100
break;
}
}
if (blocks.testForBlock(RED_CONCRETE, pos(0, -1, 0))) {
player.teleport(world(107, 111, 347))
break;
}
}
}
if (blocks.testForBlock(BLUE_CONCRETE, pos(0, 0, 1))) {
player.teleport(world(127, 110, 357))
while (true) {
if (blocks.testForBlock(LIME_CONCRETE, pos(0, -1, 0))) {
money += -200
if (money >= 0) {
mobs.give(
mobs.target(LOCAL_PLAYER),
WOODEN_AXE,
1
)
player.teleport(world(107, 111, 357))
break;
} else {
player.say("je hebt niet genoeg geld")
player.teleport(world(107, 111, 357))
money += 200
break;
}
}
if (blocks.testForBlock(RED_CONCRETE, pos(0, -1, 0))) {
player.teleport(world(107, 111, 347))
break;
}
}
}
if (blocks.testForBlock(LIME_CONCRETE, pos(-1, 0, 0))) {
player.teleport(world(127, 110, 357))
while (true) {
if (blocks.testForBlock(LIME_CONCRETE, pos(0, -1, 0))) {
money += -300
if (money >= 0) {
mobs.give(
mobs.target(LOCAL_PLAYER),
WOODEN_SWORD,
1
)
player.teleport(world(107, 111, 347))
break;
} else {
player.say("je hebt niet genoeg geld")
player.teleport(world(107, 111, 357))
money += 300
break;
}
}
if (blocks.testForBlock(RED_CONCRETE, pos(0, -1, 0))) {
player.teleport(world(107, 111, 347))
break;
}
}
}
if (blocks.testForBlock(GREEN_CONCRETE, pos(-1, 0, 0))) {
player.teleport(world(127, 110, 357))
while (true) {
if (blocks.testForBlock(LIME_CONCRETE, pos(0, -1, 0))) {
money += -200
if (money >= 0) {
mobs.give(
mobs.target(LOCAL_PLAYER),
CARROT,
1
)
player.teleport(world(107, 111, 347))
break;
} else {
player.say("je hebt niet genoeg geld")
player.teleport(world(107, 111, 357))
money += 200
break;
}
}
if (blocks.testForBlock(RED_CONCRETE, pos(0, -1, 0))) {
player.teleport(world(107, 111, 347))
break;
}
}
}
})
player.onChat("play", function () {
gezegt = 0
level = 0
EXP = 0
money = 0
player.teleport(world(107, 111, 347))
player.say("EXP = 0")
mobs.kill(
mobs.entitiesByType(mobs.monster(ZOMBIE))
)
mobs.kill(
mobs.entitiesByType(PIG)
)
gameplay.setGameMode(
SURVIVAL,
mobs.target(LOCAL_PLAYER)
)
mobs.applyEffect(REGENERATION, mobs.target(NEAREST_PLAYER), 10, 255)
loops.pause(1000)
mobs.clearEffect(mobs.target(LOCAL_PLAYER))
})
player.onChat("fix", function () {
})
mobs.onMobKilled(mobs.monster(ZOMBIE), function () {
EXP += 10
player.say(EXP)
player.say("exp")
money += 20
player.say(money)
player.say("money")
})
player.onChat("MOVE", function () {
agent.teleportToPlayer()
})
so i was making an RPG and i made it so that when i was killing zombies i would get exp and money but randomly it wil stop saying that u got exp or money , the last thing it says is the amount of exp then it stop saying anything please help.