If I understand this post correctly, Swordphin123 has made a Raycast Hitbox Module that should be really easy and useful for your cases, if you’re trying to get accurate melee weapons while optimizing and having it not be a big hassle. It uses attachments so you don’t have to hardcode the hitboxes for different weapons, and raycasts them every frame.
Another person has made a client-sided alternative to this hitbox module if you want to raycast on the client. Gives much better accuracy and low latency at the cost of a security compromise, however, you can minimize exploits on the client with sanity checks on the server for hit registration and all that stuff. (e.g. how far away the raycast is from the origin of the attachments)
As with @Extrenious’ post, it’s not 100% possible to stop exploits on the client when raycasting, but the best you can do is basic sanity checks on the server to minimize the hacks.
However, it’s up to you if you want to do stuff on the client (less lag, but is most vulnerable without server-sided sanity checks) or on the server (more security, more latency)