0

I have tried looking around for the answer, but I kept on getting answers for playing a sound on death. I want to play a sound when player respawns. Any suggestions?

2

1 Answer 1

0

For a solution, you can set up a scoreboard objective, deaths, with /scoreboard objectives add deaths deathCount. This will increment every time a player dies. Next, you need to set up another objective, health, with scoreboard objectives add health health. This will be used to check if a player is alive.

Then, place a repeating command block with the command execute @a[scores={deaths=1..,health=1..}] playsound ambient.cave master @s which leads into a chain command block with the command execute @a[scores={deaths=1..,health=1..}] scoreboard players reset @s deaths. This combination will first play a sound at every player with more than one death and that is alive, and then reset their deaths.

Hope this helps!

2
  • what version is this? the repeating command block command doesn't seem to work in 1.16.4.
    – Subham
    Jan 8, 2021 at 5:45
  • i tried editing it to repeating command block: execute as @a[scores={deaths=1..,health=1..}] run playsound ambient.cave master @s and chain command block: execute as @a[scores={deaths=1..,health=1..}] run scoreboard players reset @s deaths, but the sound plays when the player dies, not on respawn which I want
    – Subham
    Jan 8, 2021 at 5:55

Not the answer you're looking for? Browse other questions tagged .