How to make it so something happens when a player runs out of a certain item at the exact second it runs out

Like a breath metre?