Way to constantly check player health without a loop

I want to check the player health constantly and if it reaches 1 I want to run code.

I don’t want to choose a loop because I don’t want players’ frames to drop. (This is an obby with damage bricks so they could die without the if then loop detecting it pretty fast if I were to make the wait() a little slow.)

I’ve skimmed the DevForum but I haven’t had any luck.

Really just a function that detects property changes or something like that would be good, but I don’t know of any.

Well you cant constantly check anything without a loop in programming but anyway

Just use Humanoid.HealthChanged

Also behind the scenes this is a loop that constantly checks when the players health changes

humanoid.HealthChanged:Connect(function(health)
      if health == 1 then
      print("blah blah blah blah")
     end
end)
2 Likes

If you have a reference to the Humanoid then you could use:

Humanoid:GetPropertyChangedSignal("Health"):Connect(function()
   print "Humanoid health changed!"
end)
1 Like