# How to make a smooth combat system

Currently making a game which requires combat and basic chain combos. I want it to be smooth as in like it looks and feels good when the player is attacking the other player. I’m not exactly sure how to approach it, I’ve made a REALLY bad combat script in the past that had 0 chains and all it does its plays an animation and if you m1 a bunch of times, you can 1 shot the enemy. I’m not asking for a whole script I’m just asking what I should do and any tips I can use or videos I can watch to study. I want to get this game up and running and I want to possibly teach my other friend (Who’s also a scripter but worse then I am)

1 Like

Hey, I was wondering this same thing a few months ago, and from what I saw it’s best to use animation weights. Each animation has a weight, and it determines how the overwrite other animations.

For instance, if animation0 had a weight of 0 and was playing, and animation1 had a weight of 1 and then you played it while animation0 was playing, animation1 would overwrite animation0.

If animation0 and animation1 had weights of 0.5, they would blend together, and the average position of the two animations would be the result.

A great way to think about this is the following. Let’s say we have 2 animations, in the first one the left arm has a rotation of 90, in animation 2 the left arm has a rotation of 0. If both animations have weights of 0.5, the arm would be at a rotation of 45 degrees. However, if animation 1 had a weight of 0.75, and 2 had 0.25, the arms rotation would be at 67.5 degrees.

This weight system also does not have to be limited to 2 animations, you can play as many as you want and have them all influence the output as long as the weight of each anim is > 0.

A good way to transition between animations is with lerping. Let’s say the player is walking, and then they punch. We would want to have the walk animation at a weight of 1, and the punch at 0. Then, you can lerp the walk down to 0, and the punch up to 1. As the character starts putting their arm down again, you can lerp the walk back to 1 and the punch back to 0.

Below I will add some great resources for animation weights.

https://devforum.roblox.com/t/how-do-i-use-animation-weight/313047/2

if you have any more questions, feel free to reply. Hope this helps you!

8 Likes

You could start by trying to make a 4 or 5 hit combat that knocksback on last hit and then improve from there.

Client sided detection seems to be smooth for combat but make sure to add sanity checks such as checking magnitude distance between attacker and player

1 Like

Thanks for the response. I’ll be sure to use all the resources that you sent in order to master combat animations.

Thanks for the response, the problem is that I’m not as good as I want in the animation or scripting fields. I want to improve greatly on both fields and become a better animator and scripter for future projects. I’ve already attempted this but the only thing I could do was as I said, I could only make some crappy animations and a script where if you left clicked a bunch the damage would increase over and over again until you 1 shot them.