For a Minecraft map I'm making, I want public messages to be sent when a player steps on a certain pressure plate or walks through a specific door, and for the message to say who exactly did it. Also, I want it to be able to handle multiple players in the same spot and does its job respectively.
For example, if a person walks into a door, it says,
"their username has walked through the door."
I'm currently using
/tellraw @a {"text":"","color":"yellow","extra":[{"selector":"@p[distance=3]"},{"text":" has walked through the door."}]}
but it doesn't seem to work, and rather responds with,
" has walked through the door."
Any thoughts?