I have created a short command block stack, one block teleports the player and the other plays block.piston.extend. My problem is that it teleports the player before the player can hear the sound. I would like to know if there is a way to delay the command from inside that command block. I have looked at other solutions but they all involve some complex scoreboard timer thing. If you could give me a solution that doesn't use that system or maybe you could explain it better.

This is the command I need to delay:

/tp @p -586.634 64 -430.697

If anyone could help I would really appreciate it, so thanks in advance!

  • 2
    Why not reverse the order of the commands, so the sound plays second at the new location? – Skylinerw Dec 30 '16 at 9:18
  • @Skylinerw Won't it play in both cases at the original location? – RudolfJelin Dec 30 '16 at 17:39
  • that depends on your playsound. are you executing the playsound at the player using relative coordinates or are you playing the sound at a specific location? if its the former, it will play at the new position of the player, if you place it behind the tp command. if it's the latter, you can change the coordinates specified in the playsound command to change the position the sound is played from. – Plagiatus Dec 30 '16 at 18:04

allright, what other solutions are suggesting is the go-to solution, that also ensures multiplayer compatibility among other things.
and basically what you're doing is adding 1 to the player as soon as the playsound event is triggered. then you count up one to the score of the player, 20 times a second, until whatever amount you wanted to pass is passed, then the second event (the tp in this case) is triggered and the timer is reset.

Allright, now to an alternative solution to your problem:
1. The easiest way would probably be to reverse the order of the two commandblocks and just play the sound at the target location instead. this wouldn't require a delay and should be mostly multiplayer compatible.
2. You can change it to 2 commandlines which each add another command, ordered like this for the sake of easy explaining:


[1] /playsound <...>
[2] /summon falling_block ~ ~10 ~ {Block:redstone_block,Data:0,Time:1,DropItem:0}
[3] /setblock ~ ~1 ~ air
[4] /tp @p -586.634 64 -430.697

the first commandblock is triggered by whatever you want the commands to run off of, the second command will summon a falling redstone_block above the third commandblock that will take a while to fall down. adjust the height to change the delay. the third comamndblock will remove the redstone_block above itself and run the teleport command.
Be aware that this solution doesn't really support multiplayer and multiple people using it in quick succession can lead to unwanted behaviour

Not the answer you're looking for? Browse other questions tagged or ask your own question.