While OnTriggerStay i need to press n hold direction button to get input from a key, why?

I want to interact with citizen while player Collider stays on citizen trigger by pressing X key. But the problem is i need to press and hold direction key to get input from key ‘X’.
This is my code:

void OnTriggerStay2D(Collider2D other)
{

		relativePosition = transform.InverseTransformPoint(other.transform.position);
		if (Input.GetKeyDown(KeyCode.X)){
		
				Debug.Log(Input.GetKeyDown(KeyCode.X));
				player.enabled = false ;
				anim.enabled = false;
				thisanim.enabled = false;
				audio.GetComponent<AudioSource>().enabled = true;
		
				audio.Play();
				
				Textbox.SetActive(true);
				text.GetComponent<Text> ().enabled = true;
					if(textfile!= null){
						textlines=(textfile.text.Split('

'));
}

					if(endline==0){
						endline = textlines.Length - 1;
					}
					
					if(relativePosition.x > 0.5) 
								{
									Debug.Log("The object is to the right");
									GetComponent<SpriteRenderer>().sprite=spr;
								} 
								else if (relativePosition.x < -0.5) 
								{
									Debug.Log("The object is to the left");
									GetComponent<SpriteRenderer>().sprite=spl;
								}

								if(relativePosition.y > 0.5) 
								{
									Debug.Log("The object is to the above");
									GetComponent<SpriteRenderer>().sprite=spu;
								} 
								else if (relativePosition.y < -0.5)  
								{
									Debug.Log("The object is to the below");
									GetComponent<SpriteRenderer>().sprite=spd;
								}
	}
}

From the documentation:

“When a Rigidbody is moving slower than a defined minimum linear or rotational speed, the physics engine assumes it has come to a halt. When this happens, the GameObject does not move again until it receives a collision or force, and so it is set to “sleeping” mode. This optimisation means that no processor time is spent updating the Rigidbody until the next time it is “awoken” (that is, set in motion again).”

So your object is going to “Sleep” (because it is not moving), therefore its physics is disabled.

You can set the Sleeping Mode to “Never Sleep” or have a flag that indicated weather your object is in or out (set it in enter and exit) and use the Update method (if(inside && X pressed) …).