Gun followes the player

I have a player that i animated it to run, his hands move also with the animation’ i iv’e been tried to attach the gun to the player but it looks weird.
the gun does follow the player but soo weird, when i rotate the player the gun rotates also and it looks like the gun is in the Player’s ass.
i attached the gun into the player’s hand and not the player itself.

public Transform player's hand;
public Vector3 afterplayer;

void Update(){

    transform.position = Aj.transform.position + afterplayer;
}

Try attach the gun to player. You can do it with using hyerarchy or you can do it with code.
The code part is public Gameobject player; // attach layer to this Gameobject on script void Start(){ transform.parent = player.transform;