What do you want to achieve?
Make a Damage module script
2.What is the issue?
It works fine for things like checking if there is a humanoid, waiting for cool down, etc. But it won’t damage the Humanoid
What solutions have you tried so far?
Subtracting the health from the humanoid instead of using :TakeDamage() and using a remote event
Script:
local Dam = {}
Dam.Deal = function(p,c,hit,Damage,cooldown,Charge)
local h = hit.Parent:FindFirstChild(“Humanoid”)
local H = hit.Parent:FindFirstChild(tostring(p.UserId)…“Nen”)
if h and H == nil and hit.Parent ~= c then
print(p,c,hit,Damage,cooldown,Charge)
local H = Instance.new(“BoolValue”,hit.Parent)
H.Name = tostring(p.UserId)…“Nen”
if Charge ~= 0 then
h:TakeDamage(((Damage*Charge)*c.NenDam.Value)c.NenDam.multi.Value)
print(tostring(((DamageCharge)*c.NenDam.Value)c.NenDam.multi.Value))
else
h:TakeDamage((Damagec.NenDam.Value)c.NenDam.multi.Value)
print( tostring((Damagec.NenDam.Value)*c.NenDam.multi.Value))
end
wait(cooldown)
H:Destroy()
end
end
return Dam
p == player
c == Character
hit == hit in the touched event
if it hit a humanoid they would probably be like (your player,your character, body part, 20, 5, 1)
I use player for the cooldown efect;
Character so i can use a few values in it(that will multiply the damage);
Body part,Cooldown and damage for obvious reasons;
And charge is a value that increases when you charge the attack that multiplies it by 1 to 2.
Turns out it works if i calculate the damage and give it as a variable instead of doing it afterwards. Sorry for bothering you with such a dumb mistake.