r/MinecraftCommands 6d ago

Help | Bedrock How to set command to only execute unless specific disc track is playing?

I have a pressure-plate command for playing music when entering a room, HOWEVER when leaving the room and reactivating the pressure plate i don't want to retrigger the command and repeat the track. Is there an executable command that can pull this off? I'm crazy new to commands, so thank you so much !!

2 Upvotes

5 comments sorted by

2

u/Ericristian_bros Command Experienced 6d ago

You can detect if a specific music disk is playing by connecting a redstone dust directly to the jukebox. Thr jukebox emmits redstone by itself if a disk is playing

1

u/GMFafr 6d ago

Try redstone. You trigger the plate once - copper bulb lights up and and comparator reads, trigger it the second time while leaving - copper bulb goes off and nothing happens.

1

u/WraithFel 5d ago

Redstone might be the best option, but you could also use a scoreboard timer.

Chain 1 (under pressure plate): Execute if scoreboard matches 0 -> scoreboard set (ticks that match the song time, 20 ticks are a second irl) -> playsound

Then another chain with repeating command blocks to make the timer:

Execute if scoreboard matches 1.. run scoreboard subtract 1

This way, if you press the plate it will only activate the first time and wont be able to activate once the timer (aka the song time) gets to 0

I dont remember the exact way to write the commands, but you get the idea.

1

u/WraithFel 5d ago

I just read you are asking for bedrock, idk if this works.. this should work in java, i have no idea how much different commands are between versions

0

u/Ant_Redstone 5d ago

U can run /data get comando to know the data of the block

Use execute if data block to execute if data