So, I'm trying to make a gravity gun type thing in Minecraft. What I have so far is as follows.
A command block which is always powered and has the command:
/enchant @p sharpness 2
(it detects when you hold a sword).
And a command block which would be the output that has
execute @p ~ ~ ~ tp @e[type=villager] ^ ^ ^5 facing ^ ^ ^
Any help? I just need a command that detects if you look at a villager.