The way I do it for Mayhem League (a very similar game) is I create the weapon as a separate mesh, and I have bones for it on the skeleton. But the vertices of the weapon aren’t WEIGHTED to these bones, I just use a constraint inside the animating software to visualize the relationship.
The exported character rig has these empty “weapon bones” with nothing attached. Then, inside UE4, I add a static mesh component to my Character, using the weapon mesh, and I set it to be a child of the Skeletal Mesh, attached at the weapon bone (note, you may have to play around with the transform of the mesh to get it aligned properly).
Then, I can control the visibility and attachment of the mesh with ease. For example, I have an attack where the player throws his sword like a boomerang; I have a special Blueprint which has spherical collision and a copy of the sword mesh set to rotate at a constant rate; using a Notify in the throwing attack anim, I simultaneously spawn this actor and set the visibility of the attached sword to “hidden”. When the attack completes, I destroy the Blueprint actor and set the visibility of the attached sword to “unhidden” again.
I find this is the best approach; socket attachments are okay for guns but for animating melee attacks, having a “control bone” works wonders.
EDIT: As for parenting, my advice is to make ALL weapon bones/rigs children of the ROOT of the skeleton. When you want the weapon to follow the hand, you should use a constraint inside your animating software to make the bones mimic parent/child connectivity without actually BEING parented. That way you can do things like switch hands, resheath, etc. and use keyframes weighting to adjust which bone the weapon tracks (my sword bone tracks the scabbard until the hand grabs it, then tracks the hand, then at the resheath tracks the scabbard again).
Inside UE4 these connections vanish, and all UE sees is two bones which happen to move in conjunction… But when building the anims this gives you the flexibility you want.
EDIT 2: A demonstration since I love shilling for my game since examples always help!
The weapon rig has 3 bones below the root: the Scabbard, the Sword and Magazine. None is a child of the other; they are all simply tied together with constraints in Blender. The Weapon rig’s root bone is a child of the entire skeletal mesh (meaning its root bone is lower in the skeletal hierarchy than the main rig’s root bone)… but I use constraints to tie the elements together. So for example, when running, the scabbard is constrained to the skeleton’s spine, and the sword and magazine are constrained to the scabbard. When the melee combo starts, at the moment the character’s hand touches the sword, the constraint holding it to the scabbard is keyframed to be 0 weight and the one that holds it to the right hand is set to 1 weight. The advantage here is the sword can either act as a child bone of the hand OR the scabbard, without having to do compensatory animation (i.e. bending the spine doesn’t cause the sword to behave strangely).
You can also see in the combo that sometimes the sword moves to the player’s left hand (during the heavy 3-strike combo), and during the gun-swing the sword is re-constrained to the scabbard and the scabbard itself is constrained to the hand instead. Also, for the throw attack, the sword is made invisible and a new actor is spawned in its place using the same mesh and particle systems.