Problems with damage tracking

Hi, I’m trying to make a system that tracks the amount of damage a player dealt to another and the game is mostly based on magic. I’m currently testing my first magic (fire magic) with the damage tracking system and for some reason the burn damage overrides the actual ability damage. For example, the fireball does 20 damage and its burn damage (which happens a second later) does 2 damage, the damage tracking system only detects that the player did 2 damage instead of 20. Here’s my code:

Damage Tracking System (I use the print statement during the second function to detect the player and the damage dealt)

		humanoid.HealthChanged:Connect(function()
			if humanoid.Health < oldHp then
				damage = oldHp - humanoid.Health
				oldHp = humanoid.Health
			end
		end)
		
		humanoid.ChildAdded:Connect(function()
			if humanoid:FindFirstChild("attacker") then
				local attacker = humanoid.attacker.Value
				local dmgTable = {}
				
				table.insert(dmgTable, attacker)	
				
				for _, added in pairs(dmgTable) do
					local dmgPoints = added.Character.Humanoid:FindFirstChild("damagePoints")		
					dmgPoints.Value += damage

					print(attacker, dmgPoints.Value)
				end
				dmgTable = {}
				damage = 0
			end
		end)

Fireball (the part where it adds the ‘attacker’ tag)

					newExplosion.Touched:Connect(function(hit)
						if hit.Parent.Name ~= player.Name and hit.Parent:FindFirstChild("Humanoid") then
							local ehumanoid = hit.Parent.Humanoid

							table.insert(hitTable, ehumanoid)

							for i = 1, #hitTable, 1 do
								if table.find(damaged, ehumanoid) then return end

								local stuntag = Instance.new("ObjectValue")
								stuntag.Name = "StunEffect"
								stuntag.Parent = ehumanoid
								game.Debris:AddItem(stuntag, StunDuration)

								local burntag = Instance.new("ObjectValue")
								burntag.Name = "BurnEffect"
								burntag.Value = player
								burntag.Parent = ehumanoid
								game.Debris:AddItem(burntag, burnlength)
								
								local attackerTag = Instance.new("ObjectValue")
								attackerTag.Name = "attacker"
								attackerTag.Value = player
								attackerTag.Parent = ehumanoid
								game.Debris:AddItem(attackerTag, 0.1)
								
								ehumanoid.Health -= dmg

								table.insert(damaged, ehumanoid)
							end
							task.wait(1)
							hitTable = {}
							damaged = {}
						end
					end)

Burning System (the part where it adds the ‘attacker’ tag)

				local attacker = humanoid.BurnEffect.Value
				
				while isBurning == true do
					task.wait(1)
					humanoid:TakeDamage(burndmg)
					
					local attackerTag = Instance.new("ObjectValue")
					attackerTag.Name = "attacker"
					attackerTag.Value = attacker
					attackerTag.Parent = humanoid
					game.Debris:AddItem(attackerTag, 0.1)
				end