Minecraft – How to make a machine where when I press a button, it plays a specific record

minecraft-commandsminecraft-java-editionminecraft-redstone

I want a jukebox type thing where I have a list of buttons that when pressed, play a certain song. I can use command blocks if they are needed.

So far I have tried to use droppers to place disks into jukeboxes but I can't figure out how that really works.

Best Answer

You can accomplish this using the /playsound command. The syntax is:

/playsound <sound> <source> <player> [x] [y] [z] [volume] [pitch] [minimumVolume]

With it, you can play a record like this:

/playsound record.cat record @a

  • sound is the name of the sound event to play; here's a list.

  • source determines which slider on Music & Sound Options will affect the sound's volume.

  • player is a selector determining who the sound will be played to.

  • x y z are the coordinates of the sound's origin (louder the closer you are to it)
  • volume is how loud the sound is (over 1 has no effect for this), and how far away it can be heard from.
  • pitch is the pitch of the sound, between 0 and 2 (lower than 0.5 has no effect)
  • minimumVolume is the volume the sound plays to for anyone who's too far away to hear the sound normally.