How to get playsound to work in a script (newbie problem)

dualarrow

New member
Oct 5, 2021
2
0
1
I have a very simple script as follows

my_event: type: world events: after player breaks dirt: - choose <util.random.int[1].to[1]>: - playsound <player> sound:ENTITY_PLAYER_LEVELUP - case 1: - choose <util.random.int[1].to[4]>: - case 1: - drop gold_nugget <player.location.add> delay:1 - case 2: - drop diamond <player.location.add> delay:1 - case 3: - drop emerald <player.location.add> delay:1 - case 4: - drop stick <player.location> delay:1

the playsound is not coming through. I suspect it because the block breaking sound is playing and my attempt is failing. The script as a whole works and if I use the same playsound command from a /ex command, it plays the sound.

What am I missing ?
 

dualarrow

New member
Oct 5, 2021
2
0
1
Problem solved. playsound should have been fter the case 1. Also had to remove the .add after player.location