Playsound when a player leaves and area but not when they enter
//ads -- adsterra.com -- native banner
?>
I've got a sound paspawn and want to play it when people exit an area but not when they enter or teleport into it. The sound should only be played once.
Best Answer
Well first I would set up a clock and make the following commands in this order:
- /scoreboard players add @a[x=,y=,z=,r=] play 1 (@a[x=,y=,z=,r=] Is the location of where you want it at)
/execute @a[score_play_min=1,score_play=1] ~ ~ ~ /playsound paspawn @p
/scoreboard players set @a[score_play_min=2] play 2
This would play the sound one time when they are at the location and then it would never play the sound again. Hope this helps!
Pictures about "Playsound when a player leaves and area but not when they enter"



How do I trigger command blocks when a player walks in a certain area?
Put pressure plates around your desired area. under each pressure plate place a command block that will teleport you to coordinates of your choice. do this by inserting the command /tp @p x y z into your command block.How to Play Audio File in Python : playsound module (Fix Error 305 )
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ann H, Kei Scampa, Jonas Von Werne, Olha Ruskykh
