Commands let players perform actions and customize gameplay using text-based instructions. Use this topic to share feedback and ideas for improving commands and related tools.

6

/execute try - if command fails/is successful

1 Comments

Post a new comment:

Please sign in to leave a comment.

Sorted by oldest
  • 1
    Registered User commented
    Comment actions Permalink

    That's already possible with some existing commands, with the help of /execute store. You can use it to save the results of commands to a storage location, and then recall the value to test if it succeeded. Why don't you try this:

    execute store success score test results run kill @a[distance=..5]
    execute if score test results matches 1 run say Killed a player!
    execute unless score test results matches 1 run say There were no players to kill...