How To Detect How Much Damage A Player Does To An NPC?

So basically I just wanted to know how I would do this. Currently, I have a boss, and I want to be able to give the players a reward, however, it only gives the reward to whoever kills it. I want to make it where if everybody does enough damage then they will also get the reward.
This is what I Currently have.

script.Parent.Humanoid.Died:Connect(function()
	local tag = script.Parent.Humanoid:FindFirstChild("creator")
	if tag ~= nil then
		local player = tag.Value
		if player ~= nil then
			player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1000
			wait(0.1)
		end
	end
end)
1 Like

You should use

humanoid.HealthChanged:Connect(function(health)

Determine the value at which points are awarded

Inside the character being killed

You have to also put code in the killing weapon for it to work properly

This is close to the thing you want to do

Wounded 1 Coins 2

Kill 1 Coins 10

This would be handled by the weapon code. Whenever a player makes an attack against the boss calculate the damage and add it to a running counter for that boss. Then, when the boss dies, check this value.

Hi, did you figure this out?
Thanks

I’m sorry, the translation is not clear. I don’t know what you want to say. Try again