Announce when player enters the nether in 1.14?

I'm not very knowledgeable in mc commands but I had been trying to write a system that would announce if a player had entered the nether using execute and scoreboard, unfortunately the outcome was either it didn't work or it spammed chat, I eventually scrapped the whole thing out of frustration, is this even possible to do? If so what would you do?


Solution 1:

You can execute your command based on a dimension check like this:

/execute in the_nether run <command> @a[distance=0..,tag=!inNether]

And in a chain command block behind that, put this tag command so that the first command only gets executed once:

/execute in the_nether run tag @a[distance=0..,tag=!inNether] add inNether