Execute If Score Minecraft Command Tutorial. Test Scores and execute commands! Java

Video Summary
In this video I show how to set up a dummy scoreboard objective and display it, then use /execute if score to run commands based on a player’s score in Minecraft Java. I walk through the exact execute chain to target each player correctly, test score ranges (like 5 or higher), and trigger effects such as particles. I also demonstrate resetting a score when it reaches a value and automatically increasing scores when a player stands on a specific block like stone.

Formatted Transcript

Hey everyone, it’s UnderMyCap. Today I’m going to show you how to execute a command using a scoreboard. This is a really useful technique for things like checking how many times a player has killed something, how many times they’ve died, or any other value you track—then triggering an action once they reach a certain number (like 10). You could play a sound, reset the score, run an effect, and more.

This guide is split into two parts:

Part 1: Setting up the scoreboard (you can skip this if you already know how).
Part 2: Using /execute to run commands based on scoreboard values (this is the main section).

Part 1: Setting Up a Dummy Scoreboard

First, we need a scoreboard objective. We’re going to use a dummy objective, because dummy scores only change when you manually change them (they won’t automatically change due to deaths, health, etc.).

Create the objective:

/scoreboard objectives add test dummy

At first you won’t see anything displayed. To show it on the sidebar, run:

/scoreboard objectives setdisplay sidebar test

Now let’s give players a score. For example, to add 5 points to everyone:

/scoreboard players add @a test 5

You should now see the value in the sidebar.

Part 2: Executing Commands Based on a Score

Now we’ll use a command block to run commands when a player’s score matches a condition.

To get a command block:

/give @s command_block

The Core Idea

We want the command to check each player individually. That’s the key. If you don’t structure the command correctly, it may run in a way that isn’t tied to the specific player being tested.

Here’s the general structure we’ll use:

/execute as @a at @s if score @s test matches 5.. run ...

What this means:

  • execute as @a = run the following logic once per player.
  • at @s = set the execution position to that player.
  • if score @s test matches 5.. = only continue if the player’s test score is 5 or higher.
  • run = run the command you want when the condition is true.

Score Matching (How Ranges Work)

The matches keyword supports ranges:

  • matches 5 = exactly 5
  • matches 5.. = 5 or higher
  • matches ..5 = 5 or lower
  • matches 5..10 = between 5 and 10 (inclusive)

Example 1: Trigger a Particle Effect When Score Is 5 or Higher

Put the following into a command block:

/execute as @a at @s if score @s test matches 5.. run particle flame ~ ~ ~ 0 0 0 0 10 force @a

With this running, players will get the particle effect as long as their test score is at least 5. If you reduce the score below 5, the particles stop.

Example 2: Reset the Score When It Reaches 5

Let’s say you want something to happen at 5, and then immediately reset the score back to 0.

Replace the particle command after run with a scoreboard set command:

/execute as @a at @s if score @s test matches 5 run scoreboard players set @s test 0

Now, when a player hits 5, their score is set back to 0.

Copying Command Blocks (Quick Tip)

If you want to duplicate a command block without retyping everything, use the pick block feature: hover over it and press your pick block key. If you hold Ctrl while using pick block, you can copy the block including its stored command (this is really handy for making multiple similar command blocks).

Automatically Increasing a Score Based on Conditions

You might also want the scoreboard to increase automatically without manually editing it. For example: if a player is standing on stone, increase their score by 1.

This command tests the block under the player and adds to their score if it matches:

/execute as @a at @s if block ~ ~-1 ~ stone run scoreboard players add @s test 1

If you run this repeatedly (for example, with a repeating command block), the score will keep going up while the player stands on stone.

Once that score reaches 5, the earlier execute-if-score command can trigger the particle effect (or any other command you want).

Wrapping Up

That’s the core of executing commands based on scoreboard values. You can swap out the particle command for anything—play a sound, apply an effect, teleport a player, clear inventory, deal damage, and more. This method is incredibly flexible once you get used to the structure.

Thanks for reading, and I’ll see you next time.

Video Thumbnail

Advertisment

Leave a Reply

Scroll to Top