Problem With HealthChanged

Yes. I want to detect health loss. I am gonna test this.

Yeah this would work if you only want it to detect the health going down instead of “healing”

The blood input - Detecting how much health points the humanoid lost as the blood system will be connected to that.

local change = math.abs(currentHealth - health)

Oops clicked solution by accident. I was about to reply.

It still prints the health changing.

You have to set PreviousHealth when it loses health too.

to see if it went down or up [][][]

Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
	if Humanoid.Health > PreviousHealth then PreviousHealth = Humanoid.Health return end
	PreviousHealth = Humanoid.Health
	local HealthLoss = (Humanoid.MaxHealth - math.round(Humanoid.Health))
	print(HealthLoss)
end)

Thank you very much! This solution worked really well.
You are a good scripter and good at helping others! :grin:

Tho I will be changing the signal to HealthChanged since I feel like that better fits the code and is more reliable! :grinning:

Thank you so much tho. :heart:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.