How to make a character attack and register that attack in anothe rplayer?

I have been working on this project for sometime and I am stuck. I want to know how to attack a player with our character and register the attack.

Hello! What is attack action - animationor shooting? And for what purpose do you want to register it?