If statement is being ignored

Hi,

Somehow this part of my code is being ignorded: && Difference < 0.5f
When I use == instead of > it functions properly.

void Update ()
              {
		float Difference = player1.transform.position.x - transform.position.x;
			if (Input.GetKeyDown (KeyCode.Space) && Difference > 0.5f) 
			{
                                Debug.Log (player1.transform.position.x);
				Debug.Log (transform.position.x);
				Debug.Log (Difference);
                         }
               }

The Debug.Log (Difference) shows that when Difference > 0.5f the if statement still is ‘true’.

Can somebody please help me with my problem?

Thanks in advance!

The Debug.Log (Difference) shows that
when Difference > 0.5f the if
statement still is ‘true’

Isn’t that what you have coded? “If space is pressed and Difference > 0.5f then do something”. If the log is showing that Difference is > 0.5, then “Difference > 0.5)” is going to be true every time.