Animations and Hitboxes for Combat

I’ve been thinking a lot about how can I achieve a nice melee/hands combat. Obviously, I can’t do this without using animations, but I’ve came across different kinds of topics of where I should play them:

1. Play animations on the server, handling the creation of a part that should act as a hitbox, and damage a player when the part Touches the character. This method isn’t really great as it seems, because there is a delay between playing the animations from the Server to the Clients, and puts more stress on the server.

2. Let the player handle the animations, since it seems that there is no lag, because the player handles the animation, as it has Network Ownership. But this method comes as well with many tradeoffs. Creating the Hitbox would require the Client to send a RemoteEvent to the Server, saying that the animation was started. The issue is that that Client could spoof, I assume, the animations, manipulating them however he wants, to where comes a third method.

3. When the player tries to start an animation, it will first send a message to the server, checking if he’s allowed to do it, creating as a result a hitbox, and sending a response to the client to play the animation. All of this can be achieved using a RemoteFunction, haven’t used them in my development, but intend to. This seems to be the best method of all, without having many drawbacks, such as latency lag or exploitation.

I want to ask you, what kind of methods/systems have you designed in order to achieve a near perfect melee combat and what kind of drawbacks does it have. What methods do you use in order to play the hit sound effects correctly? Do you first play the audio on the client that plays the animation, since he’s the most important I assume, and then play all of the sounds to the rest of the clients? Is there a way to achieve a seamless combo with different animations, in sequence?

Sorry if there are too many questions for me to ask here, but I can’t seem to find an answer to all of my questions, since most of the old answers are kind of outdated, or lack many answers. :sweat_smile:

1 Like