How do I go about creating an armor system?

Hello, developers! While developing a game, I started thinking about how to implement an armor system into the game with my ideas being to allow players to wear armor and to gain certain buffs out of it including increasing max health and damage reduction. However, I do not actually have any idea about how to go about this, especially over the damage reduction idea. I’ve tried to think about using formulas to decide how much damage would be reduced and all, but I still do not see how this would work. I am still currently stuck and wondering if there would be any way to be able to add damage reduction through formulas or through other methods.

1 Like

This is basic one hope it help you out.

Type 1

local damage = 100 -- this is damage
local armor = 20 -- player armor

local newDamage = (damage - armor) and  (damage - armor) > 0 or 0 -- damage after got reduced, is 80

Type 2 - percentage

local damage = 100
local armor = 10

local newDamage = math.floor(damage / armor)  -- is 10
-- is armor higher 100 then the damage value will alway be 0

You can store a value for the MaxHealth (simply set the Humanoid’s Health).

The damage reduction should be a percentage.

To calculate it, first multiply by your percentage and then divide by 100: damageTaken = damageTaken * PERCENTAGE / 100

Thanks for the contribution, but would there be any way that I can be able to register the hits into an int value in a script?

You would need to do that from the script that applies the hit.

Why would that be necessary?

You could just calculate the new damage and apply that directly from the same script.

Thank you all for your contribution! I have decided to just edit the script that deals damage to the player to multiply with a damage resistance value that would be found in the player!