How exactly does damage work?

I am working on somewhat of a MMORPG and when I have the player damage the target (such as a bear or villager) for determining which one the line hit I use a cast and end up nesting. my method right now if I were to add another enemy, in order to damage that new enemy I would drag off of the cast to the new enemy blueprint and subtract some health, I want a better to damage it than nesting like that with the casting.
.