Hi, I have a script that gives you points based on your damage and for some reason it’s firing more than once when it fires the second time. I have tested the script that gives the tag and it only fires once while this fires multiple times. I have tried adding a debounce, but it didn’t really work. Are there any ways to fix this?
humanoid.ChildAdded:Connect(function()
if humanoid:FindFirstChild("attacker") then
local attacker = humanoid.attacker.Value
local dmgTable = {}
local oldHp = humanoid.Health
table.insert(dmgTable, attacker)
humanoid.HealthChanged:Connect(function()
local damage = oldHp - humanoid.Health
if humanoid.Health < oldHp then
for _, added in pairs(dmgTable) do
local dmgPoints = added.Character.Humanoid:FindFirstChild("damagePoints")
dmgPoints.Value += damage
oldHp = humanoid.Health
print(attacker, dmgPoints.Value)
end
dmgTable = {}
end
end)
end
end)