Dashing with rigidbody2D not working right

So I asked a similar question few days ago regarding jumping, and it lead me to an aswer that I’m actually cancelling out my Y velicity with the part of the script that handles rest of the movement. Now I was thinking about implementing dashing using rigidbody2D.AddForce(Vector3.right * dashSpeed); ,but the code is being cancelled out because the X value ir being updated every frame using values from directional keys, if that makes sense. So can you guys please help me figure out a workaround?

Here’s my code:

    public int HorizontalSpeed = 10;
    	public float jumpSpeed = 1000f;
    	public float dashSpeed = 1000f;
    	private Vector2 movement;
    	public bool fallin = false;
    
    void Update () {
    		//Horizontal movement
    		float inputX = Input.GetAxis ("Horizontal");
    		movement = new Vector2 (inputX * HorizontalSpeed, rigidbody2D.velocity.y);
    }
    
    void FixedUpdate () {
    
    	//Jumping
    	if (Input.GetKeyDown(KeyCode.X))
    	{
    		rigidbody2D.AddForce(Vector3.right * dashSpeed);
    	}
    
    	//Jumping
    	if (Input.GetKeyDown(KeyCode.Space) && fallin == false)
    	{
    		rigidbody2D.AddForce(Vector3.up * jumpSpeed);
    	}
    	fallin = true;
    
    	rigidbody2D.velocity = movement; //This zeroes out the x value each frame
// so I can't dash properly. It just blinks instead of being smooth. Workaround?
    }
    
    void OnCollisionStay2D() {
    	fallin = false;
    }

You can use AddForce with a force mode, i would try impulse.

You just need to disable whatever input is interrupting your dash. Idk if your dash is anything like mine, but I disable all other player actions for the duration of the dash. I have float dashDuration which designates how long I want the dash to last.

so after you do that, something like this would work:

if(!isDashing){
      rigidbody2D.velocity = movement
}