I am trying to update (from 1.12 to 1.13) my cannon system in which if a monster not on team "good" comes within a 4 block radius of the command block, the cannon will fire arrows. Also, if those arrows are in that same radius as well, the arrows will be teleported to the monster and damage it. I have it set up so that the cannon fires; that's not the problem. The problem is getting those airborn arrows to be teleported to the monster within that same 4 block radius. The whole idea of this system is to ensure that all arrows fired hit a target within that radius. In 1.12, the command I used was this:
/execute @e[team=!good,r=4] ~ ~ ~ tp @e[type=arrow,r=4] @e[team=!good,r=4]
I attempted to update this command by by doing this:
/execute at @e[team=!good,distance=..4] run tp @e[type=arrow,distance=..4] @e[type=arrow,distance=..4]
According to the error message, "the provided selector allows more than one position." How can I overcome this? Also, I would like the arrow to still inflict damage on impact, I am not sure teleporting arrows will still do damage or not.