Minecraft – How to make a sound play when an item is clicked

minecraft-commandsminecraft-java-edition

I'm trying to make a Flappy Bird minigame using the plugin Create Your Own Menus, otherwise known as CYOM.

To play, you click a feather and it goes into another menu showing that it went forward, and so on.

I need it so when the user clicks the feather, it plays a sound.

I've used the command:

/playsound entity.experience_orb.pickup master @p

And I used the plugin to implement that command into the feather, so when clicked, the sound plays. Problem is, an error message shows:

Server: Player ThePinoyPlayer is too far away to hear the sound

Best Answer

The error message says that the player is too far to hear the sound , so try instead to use the /execute command

/execute @p ~ ~ ~ /playsound entity.experience_orb.pickup master @p