How to Use the Trigger Command – Wiki Guide
This Minecraft tutorial explains how to use the /trigger command with screenshots and step-by-step instructions.
You can use the /trigger command to create a trigger that sets or adds values to scoreboard objectives that trigger enabled in Minecraft. Let’s explore how to use this cheat (game command).
Requirements
There are no requirements for the /trigger command. Even if you have cheats turned off, you can still run the /trigger command.
Trigger Command
Trigger Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac), there are different syntaxes depending on what you would like to do with the trigger.
To create a trigger that sets the value of a scoreboard objective:
/trigger <objective> set <setValue>
To create a trigger that adds a value to the current value of the scoreboard objective:
/trigger <objective> add <addValue>
Definitions
- objective is the name of the objective that will be set or add a value to.
- setValue is the value to set the objective to.
- addValue is the amount added to the objective.
Examples
Example in Java Edition (PC/Mac)
To create a trigger that adds a value of 1 to the scoreboard objective called FirstObjective:
/trigger FirstObjective add 1
To create a trigger that sets the scoreboard objective called SecondObjective to 25:
/trigger SecondObjective set 25
TIP: Before running these /trigger command examples, you will need to use to the /scoreboard command to first create the scoreboard objectives and then enable them.
To create the objectives:
/scoreboard objectives add FirstObjective trigger /scoreboard objectives add SecondObjective triggerAnd then to enable the objective for all players:
/scoreboard players enable @a FirstObjective /scoreboard players enable @a SecondObjective
How to Enter the Command
1. Open the Chat Window
The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:
- For Java Edition (PC/Mac), press the T key to open the chat window.
2. Type the Command
In this example, we will create a trigger that adds 1 to the scoreboard objective called FirstObjective.
But first, let’s create and enable the trigger objective called FirstObjective with the following /scoreboard commands:
/scoreboard objectives add FirstObjective trigger /scoreboard players enable @a FirstObjective
Now, let’s create a trigger that adds 1 to the scoreboard objective called FirstObjective with the following /trigger command:
/trigger FirstObjective add 1
Type the command in the chat window. As you are typing, you will see the command appear in the lower left corner of the game window. Press the Enter key to run the command.
Once the cheat has been entered, the trigger will be created.
You will see the message “Trigger FirstObjective changed with add 1” appear in the lower left corner of the game window to indicate that the trigger was successfully configured.
Congratulations, you just learned how to use the /trigger command in Minecraft!