Does anyone have a good Sword system?

I want to give the player a sword and allow him to use it when you press a button while moving in the WASD controls. i have seen a few diffrent systems in other games but they were too complicated or didn’t work with my game .

Did you see the two sword examples here: ?

yes but it does not work for my characters movement bundle

and i tired replicating the movement from that game to combine it with the sword program but it just does not work

Basically what these examples are doing is emitting an object (or hitbox) in front of the player.
Anyone who touches that object is considered to be “hit”.