When a player dies they respawn in their spawnpoint, but I made a way to teleport them when death is detected (though a minecraft:die scoreboard) and using storages to get their deathX Y Z and it works fine, but only if the player dies when using /kill. If they die from fall or other thing it works and stores the coords fine but it dosents tp the player? why can this be?
#How to teleport a player to his death location
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
Someone will come and help soon!
💬 While you wait, take this time to provide more context and details.
🙇 If nobody has answered you by <t:1745443648:t>, feel free to use the Summon Helpers button to ping our helper team.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
there is very little code in this pack
It's probably faster if you take a look
yeah thats exactly what I do
i send a tellraw with a click event to tp and that works
what dosents work is using the function the same tick the player dies
because the player is dead
but it does work when you die by /kill
idk if there are differences how that's handled
i can fix it by running ts a tick after or smthng
btw can you store the facing coordinates?
like ts
i want to tp @s ~ ~ ~ ~ ~
you can read the players Rotation nbt
don't rotate with teleportation, use the rotate command
i dont understand rotate cmd
/rotate @s <pitch> <yaw>
what is the nbt path for pitch nd yaw in a player?
Rotation
what entity could I use to save coords and rotation
so I can do tp @s @n[type=,tag]
use macros
i did that but I means sicne i cant tp the player at the death tick
the macros doesn't get more expensive if you add more variables
i could summon an armor stand at the death coords with macros
and give this player a tag
and run repeat tp all players with a tag to the neares armor stand
if you really want to go this route, at least use a marker
okay so a marker has rotation and stuff
is not that I want to but I dont know how else to teleport the player to the spot
like I could do 2 or 3 functions with storages but idk if this is optimized
why do you want to tp them while they're dead (or in the respawn tick)?
no idea what you need that for
okay maybe im dumb or smthng
but if I have a few players that can die at any time
and I need to loop tp them to where they died
or if they die at the same time
is there any score that saves time since last death?
nice
yaw and pitch always get saved as 0 0 i guess because the function is run at the death tick?
just make it run 1 tick later
but then you are not getting the yaw and pitch the player had when he died, but the one he has at respawn
you could periodically store that data
dosents this lag so much?
specially since I need to use a dinamyc store
nbt manipluation is bad but not that bad
$execute store result storage pdm:player main.$(id).gameData.deathanim.yaw int 1 run data get entity @s Rotation[0]
$execute store result storage pdm:player main.$(id).gameData.deathanim.pitch int 1 run data get entity @s Rotation[1]
so every tick i have to run
my health display datapack also uses dynamic, entity specific data stoprages. and it does much more nbt stuff than that. You don't even notice that.
a function to get my id and another with macros to save my yaw and pitch
okay okay
periodically doesn't necessarily mean every tick
yeah but fact is players move their camera a lot specially in a quick fight game
is schedule good ?
like schefule functoon save 5t
im on aternos server so optimization is important