Minecraft – Can scoreboard triggers be disabled

minecraft-commandsminecraft-java-edition

Story

The trigger scoreboard type is used to allow players, even without cheats, to modify their value of a scoreboard objective. By typing /scoreboard players enable <playerName> <objective> this will allow that player, even without cheats, to use /trigger to change their scoreboard value. After triggering, that trigger is disabled again until the enable command is typed again.

Problem

While there is a command /scoreboard players enable, there isn't a /scoreboard players disable. In other words, I can't disable a trigger that has previously been enabled, and now I have to hope that the player doesn't find out and use /trigger, or it will break my map.

Core question

Can scoreboard triggers be disabled? If so, how?

Best Answer

You can't directly disable scoreboard triggers, but you can instead trick Minecraft into thinking that the player used /trigger, using /execute.

execute as @p trigger myObjective add 0

This command will disable the trigger of the nearest player. Because the /trigger is being executed by the nearest player, this makes Minecraft think that they use their trigger.

Related Topic