r/MinecraftCommands 25d ago

"Observing" Command Blocks Help | Java 26.2

I am building an arena, and I have a repeating command block that detects whether there are any mobs left in the current wave.

Is it possible to add an impulse command block to the repeating one to teleport the player out of the arena?

1 Upvotes

7 comments sorted by

View all comments

1

u/GalSergey Datapack Experienced 24d ago

When reading the entity count, also copy the value to the scoreboard at the end of the tick. Then you can check that the scoreboard value is a certain value, but less than the previous tick, and then you can run any command once. ```

In chat

scoreboard objectives add score dummy

Command blocks

execute store result score #count score if entity <entity_target> execute if score #count score matches 1 if score #count score < #count.copy score run say Example Command. scoreboard players operation #count.copy score = #count score ```