Need help With Sword Damage

Before I even start: please stop using the parent argument of Instance.new.

Ideally your statistics should, if you’re looking to increase some kind of stat, be multiplicative of some kind of base modifier and additive of an overall base stat. For example, say your sword has a base damage of 16. You’re going to want to then add to this 16 using your stat. As for the stat itself, how it grows is also dependent on your calculations. For example, for every point in Power, 0.15 damage is added to the sword.

You’re looking at the formula baseDmg + (dmgPerPoint * powerPoints) where baseDmg is the damage the sword starts off with and the equation in the parenthesis shows that a certain base factor should be multiplied by the power points to get the damage increase. The same formula applies for health and anything else where you require a stat to increase a base from something.

With that formula in mind, all you’re doing is filling in where necessary in and around your code. For setting what a Humanoid’s health can be, just detect changes to the power stat and then apply the formula to MaxHealth. For damage, calculate the increase before applying damage.

2 Likes