I don't know why the playsound command doesn't play when the player gets teleported
I was triying to make a teleporter when a player steps on a obsidian block, but the sound wont play. Here's the command blocks if that's any help.
Repeat, always active:
Execute as @a at @s if block ~ -1 ~ obsidian as @s run title @s title §l§b¡Bienvenido...
Chain, conditional, always active:
execute as @a at @s if block ~ ~-1 ~ obsidian as @s run title @s subtitle §l§b...A la base §cnether
Chain, always active:
execute as @a at @s if block ~ ~-1 ~ obsidian as @s run to @s 0 -60 3
(wont sound) Chain, always active:
execute as @a at @s if block ~ ~-1 ~ obsidian as @s run playsound portal.trigger @s ~ ~ ~
Both the playsound command and the teleport command check for obsidian under the player's feet. So likely what is happening is either:
The player walks onto obsidian and you teleport the player away first, so the sound doesn't play since they are no longer on obsidian,
Or even if you play the sound first, it is played at where the player is before they simultaneously get teleported away and can no longer hear it.
Solution? You can still check for obsidian and run the command (as long as it is checked first before getting teleported away) but perhaps instead of ~ ~ ~, play the sound at the destination coordinates.