What is the most efficient way to create a fighting system?

In terms of fighting, I was wondering what the best way was to create a fighting system (including stuns and hitboxes) because I’m not really sure on how to create one. The weapons would usually range from swords to daggers.

The question your asking is relatively vague, while I understand as a reader then you want to create a sword/dagger weapon, I don’t understand what that entails. Do you want blocking, parrying, combo’s, and so many other things?

To answer the questions asked directly, as to how you should handle hitboxes and potentially stuns.

Stuns, stunning will be up to you, you can use your hitbox handler to detect when a user is hit and then play an animation, set platform stand, etc…

To do hitboxes really comes down to you the developer. I don’t recommend doing “Touched” due to the logic being known to being extremely buggy, see the following post for more details as well as an efficient way for hit detection.

I’m working on a fighting game and I’ve been using module scripts for a lot of things idk if I’m using them the best way but it works.

I have a module script that has the stats of every move of a character and then whenever the player inputs a key on the server I get the stats of the move and then send it to a function in another module script

But um yeah not much help probably but that’s how I’ve been doing it

most fighting games use box hitboxes that usually aren’t entirely accurate to the model/animation, though you can easily go for a faster approach for hitbox by using the weapon models as hitboxes themselves, you’d be very limited on how you can structure attacks (i.e you’ll be forced to change animations in a way that’d make them look bad just so the hitboxes can be usable, overall jankiness in attacking if the hitbox model is too short). if you do go the box approach (which I highly recommend), you can use Region3 to generate a hitbox with the size and position of your chosing and check for valid targets inside said Region3 every frame it’s active. as for the method you should be using to deal damage, unfortunately the way roblox’s netcode is handled no matter how you deal damage one party would feel frustrated in some way (you’ll see that in the majority of online fighting games matches usually have very very slow framerate, this is to sync up both players’ actions and keep the hitboxes to ‘what you see is what you get’, roblox uses a more traditional online game netcode where if one party is lagging, the others will still experience the game at full speed, this however will leads to janks in hitboxes as what you see will NOT be what you get), you can choose between
A. have the hitbox be handled by the client, which would make the experience of the attacker more enjoyable but makes the receiver’s gaming experience less so as they’ll be hit from far away from the attacker because of the difference in position between the players on both scenes, and will also leads to rooms to exploitation unless you’re confident you’re competent enough to stop this. despite this I’d still highly recommend this route
B. have the hitbox be handled by the server, which would, in theory, makes things fair for both parties, however as the client’s view and server’s view are almost always different + the delay in detection, this would be a very poor choice unless security is something you absolutely need

1 Like

Yep I recommend you do it on the client just add a lot of sanity checks, on a project I’m working on initially I had done it on the server but the latency made it terrible for laggy players to get any kills, which is why almost every, if not all, popular fighting games on roblox uses client side hit detection for everything. Also, raycasted melee weapons are perfect for hit detection and it works really well, all other methods are either inaccurate or too expensive.

thanks to everyone responding! i’ll try looking deeper into this