execute at @s run summon marker ~ ~ ~ {Tags:[CasUndomarker]}
execute store result entity @e[tag=CasUndomarker,limit=1] respawn.pos[0] double 1 run scoreboard players get @s CasUndoX
execute store result entity @e[tag=CasUndomarker,limit=1] respawn.pos[1] double 1 run scoreboard players get @s CasUndoY
execute store result entity @e[tag=CasUndomarker,limit=1] respawn.pos[2] double 1 run scoreboard players get @s CasUndoZ

execute at @e[tag=CasUndomarker,limit=1] align xyz positioned ~.5 ~.5 ~.5 run tp @s ~ ~.1 ~
execute as @a[tag=recall] unless data entity @s respawn.dimension at @s in minecraft:overworld run tp @s ~ ~ ~
execute as @a[nbt={respawn:{dimension:"minecraft:the_nether"}}] at @s in minecraft:the_nether run tp @s ~ ~ ~
execute as @a[nbt={respawn:{dimension:"minecraft:the_end"}}] at @s in minecraft:the_nether run tp @s ~ ~ ~
execute as @a[nbt={respawn:{dimension:"survivalplus:backrooms"}}] at @s in survivalplus:backrooms run tp @s ~ ~ ~

kill @e[tag=CasUndomarker]
advancement revoke @s only survivalplus:finale/tpspawn