/tellraw using wrong player when using with command block in nether
[Java Edition 1.15.2] I have a pressure plate that activates two command blocks in the nether:
execute as @p in minecraft:overworld run tp @p 98 67 101 180 0which teleports the player from the pressure plate in the nether to a specific location in the overworld facing north.tellraw @a {"text":"","color":"green","bold":true,"extra":[{"selector":"@p"},{"text":" has teleported to the overworld!"}]}which tells the chat who teleported and to where.
I have the same thing in the overworld going to the nether. This works perfectly fine when going from the overworld to the nether, however, when going from the nether to the overworld the tellraw command block targets my friend in the overworld with @p instead of me.
For example, say I am playerOne and my friend is playerTwo. When I am going from the overworld to the nether is says playerOne has teleported to the nether! which is what is supposed to happen. But, when teleporting from the nether to the overworld, I see playerTwo has teleported to the overworld! which is incorrect.
How can I get this to work so that it is always the nearest player no matter what the dimension? If it makes a difference, playerTwo is always in the overworld while this is happening.
Pictures about "/tellraw using wrong player when using with command block in nether"



Do command blocks work in the Nether?
If a single portal block is placed using commands, it can still be used to travel to the Nether.How do you use a command block in Tellraw?
ExamplesHow do you allow players to use command blocks?
Go to the \u201cserver. properties\u201d file in your server's config files. Change the line that says \u201cenable-command-block=false\u201d to \u201cenable-command-block=true\u201d Give yourself a Command Block by opening the chat box and entering \u201c/give [your username] minecraft:command_block\u201dHow do you make a Tellraw say a player name?
Tellraw allows for a "selector" part, which takes any selector you want and displays a name. You should do: /tellraw @a {"text":"","color":"blue","extra":[{"selector":"@p"},{"text":" has won the game!Why Sudo Is The Best Command in Minecraft
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Fardad Postwala, Tatiana Syrikova, Sora Shimazaki
