Event problem in a function which causes a loop

I know where the problem is found at the level of the player when he dies his reperepeuse his death several times because the function is called several times, could you help me? the problem is in the title, here is the code and thank you for your help.

local function takeDamage(player: Player, instance: Instance, damage: number)
	local humanoid = instance.Parent:FindFirstChild("Humanoid"):: Humanoid
	if humanoid then
		local otherPlayer = Players:GetPlayerFromCharacter(instance.Parent)
		if not otherPlayer then return end
		humanoid:TakeDamage(damage)
		
		humanoid.Died:Once(function()
			--setData(player)
			notificationEvent:FireAllClients(player.Name.." Kill".. humanoid.Parent.Name, Color3.new(1, 0.184314, 0.184314))
		end)
	end
end

Yes, but where is the takeDamage function called? That’s probably your error.
If it’s a Touched event you may be firing it multiple times because you aren’t using a debounce.
We need to see the code that calls the function as well.

function Gun:shoot(instance) -- PRESS MOUSEBUTTON1CLICK
	if self:canShoot() then return end
	
	local start = os.clock()
	
	if self.ammunition > 0 then
		
		self.shootState = false
		self.ammunition -= 1
		
		gunEvent:FireClient(self.player, Enums.GunEvent.Shoot)
		
		if instance then
			takeDamage(self.player, instance, self.damage)
		end

		gunEvent:FireClient(self.player, Enums.GunEvent.Shoot, self.ammunition, self.max_ammunition)
		
		task.wait(self.shootTime - (os.clock() - start))
		
		self.shootState = true
	else
		notificationEvent:FireClient(self.player, "reload your gun ! (Press R)", Color3.new(1, 0.184314, 0.184314))
	end
end