Play animation when health changed

hello, im trying to make that if the player health changes, an animation plays. But for now the print wont event show up, can someone help?

game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").Health.Changed:Connect(function()
	print('ehehe')
end)
game.Players.LocalPlayer.Character:FindFirstChild("Humanoid"):GetPropertyChangedSignal("Health"):Connect(function()
	print('ehehe')
end)

thanks! i very appreciate it alot

but how do i make it play a random animation? here is what i came up with… (which wont work)

script.Parent.OnServerEvent:Connect(function(plr)
	local hum = plr.Character:FindFirstChild("Humanoid")
	
	local hit1 = hum:LoadAnimation(script.Parent.hit1)
	local hit2 = hum:LoadAnimation(script.Parent.hit2)
	local hit3 = hum:LoadAnimation(script.Parent.hit3)
	
	local r = math.random(1,3)
	
	if r == 1 then
		hit1:Play()
	end	
	if r == 2 then
		hit2:Play()
	end	
	if r == 3 then
		hit3:Play()
	end
end)
``

There are many ways of doing this!

The First is referenced from czo which works really well!

hum = script.Parent.Humanoid

hum.HealthChanged:Connect(function()
	print("Owie")
end)

This is healthChanged And You need the humanoid refrenced this is a script not a local script and it is located in StarterCharacterScripts.

=====METHOD2 CZO’s METHOD

This is a cleaned up version of czo’s method and it also runs from a normal script not a local please Remember all can be easily transitioned to local scripts!

hum = script.Parent.Humanoid

hum:GetPropertyChangedSignal("Health"):Connect(function()
	print("Owie")
end)

Both work

This is to clear off the confusion

There is a better way lemme get the example

where should i put the animation folder?

Sorry for the late response most better place place is replicatedstorage