
summon armor_stand ~ ~ ~ {Invisible:1b,NoGravity:1b,CustomName:"{\"text\":\"respawn\"}"} 

scoreboard players add @s Death 1
execute store result entity @e[limit=1,name="respawn",type=armor_stand] Pos[0] double 0.0001 run scoreboard players get @s SpawnX
execute store result entity @e[limit=1,name="respawn",type=armor_stand] Pos[1] double 0.0001 run scoreboard players get @s SpawnY
execute store result entity @e[limit=1,name="respawn",type=armor_stand] Pos[2] double 0.0001 run scoreboard players get @s SpawnZ
execute store result entity @e[limit=1,name="respawn",type=armor_stand] Rotation[0] float 0.0001 run scoreboard players get @s SpawnU

tp @s @e[limit=1,name="respawn"]
kill @e[name="respawn"]
playsound minecraft:entity.player.death master @s ~ ~ ~ 1 1