How to make a better kill feed

I’ve got a script that checks if the player’s health is 0, and if it is, it displays the kill message. The problem with this is that if they are already dead and you keep shooting them, the message keeps on displaying. Anyone know how to make it so that is only detects when you kill them and not if they are already dead?

if humanoid.Health <= 0 then
	moduleScript.killMessage("Headshot", player, model)
							
	if game.Players:FindFirstChild(model.Name) then
		moduleScript.gotKilledMessage("Headshot", player, game.Players:FindFirstChild(model.Name))
	end
							
	moduleScript.fatalHit(model)
end

1 Like

if humanoid.Health <= 0 and not humanoid:GetAttribute("Dead") then
	humanoid:SetAttribute("Dead",true)
	moduleScript.killMessage("Headshot", player, model)
							
	if game.Players:FindFirstChild(model.Name) then
		moduleScript.gotKilledMessage("Headshot", player, game.Players:FindFirstChild(model.Name))
	end
							
	moduleScript.fatalHit(model)
end

Just use attributes to check if the humanoid has already died

Add a tag to the player that died after registering that they died once, then in the kill feed script check if the tag is there, if it is, don’t display it. If it isn’t there, display the kill feed message and then add the tag