hi guys. i got this while using my burning system, when the target got hit the damage was stacked, instead of dealing 1 time per hit it deals 6 times
Here a part of the system:
function module.BurnHit(Info)
local self = setmetatable({}, module)
local OnHit = Instance.new("BindableEvent")
self.OnHit = OnHit.Event
self.Hit = OnHit
local Hitbox = Instance.new("Part", workspace)
Hitbox.Size = Info.Size
Hitbox.CFrame = Info.CFrame
Hitbox.Anchored = true
Hitbox.CanCollide = false
Hitbox.CanQuery = false
Hitbox.Transparency = 1
game:GetService("Debris"):AddItem(Hitbox, 1)
local cf = Hitbox.CFrame
local size = Hitbox.Size
local overlap = OverlapParams.new()
overlap.FilterDescendantsInstances = {workspace.Db, game:GetService("CollectionService"):GetTagged("WindShake"), game:GetService("CollectionService"):GetTagged("Swim"), Info.Char:GetDescendants(), Info.Avoid}
local hitchar = {}
local idk = workspace:GetPartBoundsInBox(cf, size, overlap)
local no = 1
for i, p in pairs(idk) do
local cd = false
local dmg = 0
local step
if p.Parent:FindFirstChild("HumanoidRootPart") and p.Parent.Name ~= Info.Char.Name and p.Parent:FindFirstChild("Torso") and p.Parent:FindFirstChildOfClass("Humanoid") then
if not table.find(hitchar, p.Parent) then
table.insert(hitchar, p.Parent)
--DealUnphysicaldDmg(Info.Dmg, p.Parent, Info.Char, Info.CritChanceBonus, Info.CritDmgBonus, Info.Player)
else
task.spawn(function()
if step then
step:Disconnect()
end
step = rS.Stepped:Connect(function()
if not cd then
cd = true
if dmg < Info.TotalDmgDeal/no then
print("Burn")
dmg += Info.Dmg/no
DealNonCritDmg(Info.Dmg/no, p.Parent, Info.Char, Info.CritChanceBonus, Info.CritDmgBonus, Info.Player)
OnHit:Fire(p.Parent)
elseif dmg >= Info.TotalDmgDeal/no then
step:Disconnect()
end
task.delay(Info.DelayTime, function()
cd = false
end)
end
end)
end)
end
end
end
overlap:AddToFilter(hitchar)
end
Client Side:
local BasicInfo = {}
BasicInfo.Dmg = 5
BasicInfo.Physical = false
BasicInfo.Char = c
BasicInfo.CFrame = hitVFX.CFrame
BasicInfo.Pos = hitVFX.Position
BasicInfo.PARENT = hitVFX
BasicInfo.CritChanceBonus = 10
BasicInfo.CritDmgBonus = 25
BasicInfo.Range = 0
BasicInfo.Size = folder2.StrikeArea.Size
BasicInfo.Avoid = nil
BasicInfo.DelayTime = .4--the time distance between each attack
BasicInfo.TotalDmgDeal = 50
BasicInfo.Player = p
folder2.FindPart:FireServer("Shock", BasicInfo)
Server Side:
folder.FindPart.OnServerEvent:Connect(function(p, Style, Info)
if Style == "Shock" then
findPartModule.BurnHit(Info)
end
end)
here’s the dummies im using
the damage that they got:
also the damage for single dummy:
im using the damage indicator to detecting the damages
as you can see, the module deals more than 1 time per BasicInfo.DelayTime--the time distance between each attack
,
Sorry for poorly explaining, English was not my origin language
is there any way to fix this?