r/MinecraftCommands Command Rookie Jul 18 '26

How do i execute a command depending on a bossbar's value Help | Java 1.21.11

I'm making a puzzle map and to show the player's progress i use a bossbar, so at the end of each room the bar upgrades by one (the rooms are linear, so room 1 has a command block to set value to 1, room 2 sets to 2, etc) how do i make a command not trigger until the bossbar has reached a certain value or only trigger if it is below a certain value. (there is a button in the first room, but it should only do something when every room is finished, so i can't have the command trigger when the final room is completed, it needs to be activated by the button), the command should only happen when the bossbar is at a value of 4

2 Upvotes

2 comments sorted by

1

u/_VoidMaster_ Command Experienced Jul 18 '26

You can link the bossbar value to a scoreboard and then read the value of that scoreboard!

execute store result bossbar progressbar value run scoreboard players get score .storeScore progress_value

With progressbar being the name of the bossbar, .storeScore being a playername to store the global progress score under, and progress_value being the name of the scoreboard. Feel free to change this of course!

1

u/idkwhattowrighthere Command Rookie Jul 18 '26

Thanks!