How do you run a command after some playsound music?
I'm making a map, and, to put it simply, I need to run a command when some music finishes (played via a playsound command), and my only solution at the moment is a huge room full of repeaters making a delay as long as the music, with the command block at the end, which would work, but, for obvious reasons, I don't really want to do that. Can anyone help? If you have any more questions, ask in the comments, and I'll try and get back to you. Thanks in advance!
Best Answer
You can create an structure like that:

And when music start to sound execute /time set command substracting 20 to 22340 by each seconds you want to delay the command.
For example:
If music duration is 10 seconds you must delay the command by 10 seconds so:
22340-(10*20) = 22140
So you must execute
/time set 22140when music starts soundIf music duration is 17 seconds you must delay the command by 17 seconds so:
22340-(17*20) = 22000
So you must execute
/time set 22000when music starts to sound
I hope I've explained that clearly
Pictures about "How do you run a command after some playsound music?"



How do you use commands in Minecraft with sound?
After successful execution of the program, audio file will start playing. Now Click on terminal, once you see the cursor, type Ctrl+C , it will bring you out of the terminal and audio will also stop playing. That will stop the whole program, which may or may not be what the OP wants.Playsound (1.15-1.16) (Command Tutorial) (All Command Series)
More answers regarding how do you run a command after some playsound music?
Answer 2
You could have a dispenser with arrows in it pointing towards a wooden button and when the music starts trigger the dispenser. The arrow will despawn in 60 seconds (1 minute). For example, (I did this very same contraption) I played records.11 and triggered the dispenser, shot one arrow, and afterward I had a line of repeaters (4 tick) that triggered a tp command in the end.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio, Andrea Piacquadio
