How would I make a player take damage when they're looking at another player
I am playing a Minecraft: Education Edition world and I want to make it so 1 player is the monster and the rest are runners. The ideal result would be the monster turns invisible then reappears in front of another player and then while that player is looking at the monster while not invisible they take damage and are slowed. Is there a way to do this?
Best Answer
You could try using a proximity detection so that if the runner is close to the monster while the monster is visible it will do the blindness and damage. You can create the proximity detection by using the /testforplayer command and x y z dx dy dz to test a specific location and then have a comparator going out of the command block and into another one that will provide slowness and poison to the player.
Pictures about "How would I make a player take damage when they're looking at another player"
How do you make a player take damage in Minecraft?
To damage a player, set that player's damage scoreboard to how much damage you want to apply(negatives heal players), then run the function editor:deal_damage as the player you want to damage and you are done.How do you detect if a player is looking at an entity?
List and summary of commandsCommandDescriptionBE/difficultySets the difficulty level.Yes/effectAdds or removes status effects.Yes/enchantAdds an enchantment to a player's selected item.Yes/eventUsed to trigger an event on an entity.Yes25 more rowsPlayer Damage and Death - Unity FPS Tutorial
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Andrea Piacquadio, Alesia Kozik, RODNAE Productions, cottonbro