I got the combos down for my combat script. Now one thing I have on my mind is about whether I will be doing client side or server side for hit detection. I was planning on using magnitude for hit detection. But I was going to do this in the local script, if player rootpart magnitude - otherplayer magnitude is less than 3, then it will fire a remote event for the server script to damage the other player. But before server script damage the other player, it will also check the magnitude. If the magitude is still less than 3, then it will do damage. I need your thoughts on if this will be a good idea or not.
No this is a bad idea, magnitude shouldn’t be the determining factor in general.
Why? I am going to use the Dot product to determine if the player is facing towards the player and not behind
-
There’s no point checking it both clientsided and serversided UNLESS you’re really trying to catch exploits
-
I myself have made a pretty advanced combat system with combos and stuff like that, Just use parts as hitboxes imo, it let’s you be far more specific in when you want attacks to hit, or not. Another good thing you can do with parts as hitboxes is allowing the player to visualise them, so they can get a good understanding of how they can use to move, with magnitude you just can’t make such a feature.
Also many people say “oooh .Touched is trash cuz it’s inconsistent”, well, it’s not .Touched being the issue, it’s called tunneling, you might search need to search it up, essentially, when the hitbox in this case, is moving very fast, the server might not render a frame where the hitbox and opponent collide. So my advice is to not attach hitboxes to specific limbs and have them move along with them, but attach the hitboxes to the humanoidrootpart with proper offset, so the hitbox doesnt move and the server wont miss a frame of interaction
edit: I added a video explaining tunneling (this is like the only one I could find)
Or you can just use raycasting because it’s about as accurate as you can get, consistent, and is more performant than .Touched. Not to mention raycasting allows you to do much more detailed things with hits because it returns not only the part it hit, but also the hit position, surface normal, and material of the hit. It’s just better in every way
This is an amazing and easy to use module perfect for hit detection.
Also to answer OP, never do server sided hit detection, it’s horrible for the user experience. Do client sided hit detection with server side validation. The only cons to this are exploits and latency (you hit someone on your screen because they were in the right position on your screen, but on the other person’s screen they weren’t in that position), but it allows for a much better experience and is smooth and consistent for the player. Also, for server side magnitude checks for close combat, 3 studs is way too small. You’ll be hitting blanks all the time, replication is not fast enough for you to have it that small. 7-10 studs is the sweet spot, because that also gives players with slightly higher ping a good experience as well.