Trying to pick one or the other

I have 2 progress bars one for hunger one for thirst. I pick up two different items, item 1. is water item 2 is food after I pick them up they go into the inventory when I open the inventory I see both items the problem is when I click to use the water both the thirst bar and hunger bar go up. The way it should work is if I click to use water then only the water bar should go up and if I click to use the food only the food bar should go up. Here is the script can anyone tell me what I am doing wrong?

function UseEffect () 
{   if (Thirst.tcurHP == true && Hunger.fcurHP == false);
	{
		Thirst.tcurHP += 25;
	}
	 if (Thirst.tcurHP == false && Hunger.fcurHP == true);
	{
		Hunger.fcurHP += 25;
	}

I’m not sure what those variables are. Is Thirst.fcurHP the current thirst level, and Hunger.fcurHP the hunger level? If so, you should learn about types. In most languages, variables can only be one type at once - and in this case, yours are an integer, or int. When you compare something to true or false, it has to be a boolean type. The problem you’re having here is that you’re using what’s called an “implicit cast”. You can convert variables from one type to another, and sometimes you can do so without explicitly stating that you want to. In this case, int can be implicitly converted to boolean by assuming 0 = false and any value greater than 0 is equal to true. Thus, your tests are fallacious. You need to set a different flag when you select the object, which determines which object you’ve just selected. The reason both bars go up is that you’re actually testing the levels of the thirst and hunger, not what item you’re using, which is what you need to do.