Feedback on my Damage handler(Alpha)

Hi today I made this free model called DamageHandler, that can process damage and do defence and stuff, and I think I did a pretty good job at it, but I want your feedback, so please tell me what I should change / add! this is the model ↓

This is the model that gets automaticly added ↓

How to use

Setup

Just download the DamageHandler
and then put it in the ServerScriptService, and you’re good to go!

Functions
TakeDamage()

Parameters

  • Attacker - Instance: The player of the attacker
  • DamageAmount - Integer: The amount of damage to deal

Returns

  • DamagedAmount - Integer: If done 10 damage but the character only took 5 damage then returns 5

Sample code

local DamageAmount = 10;
local Attacker = game.Players:GetPlayerFromCharacter(Tool.Parent);
--You set this value abouve to the player who is attacking the other.

DamageProcessor:TakeDamage(Attacker, DamageAmount);
Heal()

I have not done too much about this function at the moment.

Parameters

  • HealAmount - Integer: How much the character should heal.

Returns

  • HealedAmount - Integer: If HealAmount is 10 but the character only healed 5 then returns 5

Sample code

DamageProcessor:Heal(HealAmount);
Setting up base status

If you double click the Configuraion in the DamageHandler folder, you will see this ↓

local module = {
	DefaultStatus = {
		Damage = 5;
		Defence = 0;
	};
};

return module

This is the default status all players will receive.
When using the TakeDamage() function,
the DamageAmount get’s added to the attacker’s BaseDamage,
But the damage get’s subtracted by the defence of the attacked character.

What to do when you want to make a dummy take damage aswell?

If you put any instance named “DamageProcessorTicket” the script will automaticaly add the DamageProcessor module and the BaseStatus modlue to the dummy.

Also keep in mind that this is still in alpha so please don’t use for a real game yet.
And that’s about all you can do, thanks for you reading this, and I look forward to your feedback!

2 Likes

I think I’m slightly confused, why should I use this module instead of just humanoid:TakeDamage(number) and humanoid.Health+=number?

okay so, maybe it’s just me but I really don’t agree with damaging a player and then healing them immediately afterwards, imagine if you had a particle effect that appear when you heal, you will have to manually make a code that prevent the effect from appearing when dealing with defense

Hmm, so do I put this module in the workspace or in the character? I’m confused.

you put the DamageHandler folder in the ServerScriptService, you don’t need to put the DamageHandler-MainModule anywhere as it will get added automaticaly

New update! Sounds and Visual effects!

You can now set a custom sound and also configure if you want the character to turn red when damaged.

To do this, open the Configuraion in the DamageHandler folder, and add this code in the module

HitEffects = {
	Audio = {
		SoundId = "Default",
	},
	TurnRedOnHit = true
}

If you already have this code in your module you don’t have to do anything.

So if you change the SoundId from default to your own then of course that will get played,
and if you want to set the sound group, then right below SoundId,
SoundGroup = your SoundGroup
Every other properties are the same, you just put the Property name and the value next to it.

If you make TurnRedOnHit to false it wont make the character red when hit.

Thats not what I meant, anyways it shouldn’t make a difference even if you did do that. I’m wondering whats the point of this module, is it like for holding values in a table for specific entities?

well I mean woulden’t it be faster if you could just put a module that do all that stuff for you without having have to do it yourself, right? Isn’t that the point a free model?

Yes, I guess it is, but I’m still slightly confused. This is supposed to be used with humanoids right?

yes, it is, the loader script parents the DamageProcessor to all the player’s character, and any character with “DamageProcessorTicket” in it

I keep getting


(I’ve never tried using insert service)

My games settings:


(I dont know if these help)

ahh ofcorse I forgot about that let me fix it

try again the problem was that I forgot to allow copy of the sound I uploaded