I need to move my Rigidbody2d gameObject to particular position according to the transforms x position

I have 4(four) empty gameObject in my scene which i used as move points.
I just need my player gameObject to move towards the particular gameobject.
I have stored the gameobjects transform in a array having size 4.

 void MoveTowardPoint()
 {
        if (transform.position.x > 0f && readyFornextmove)
        {
            rb.MovePosition(movepoint[0].position);
        }
        else if (transform.position.x < 0.5f && readyFornextmove) 
        {
            rb.MovePosition(movepoint[1].position);
        }

        else if (transform.position.x < 1f && readyFornextmove)
        {
            rb.MovePosition(movepoint[2].position);
        }

        else if (transform.position.x < 1.5f && readyFornextmove)
        {
            rb.MovePosition(movepoint[3].position);
        }
    }

i just made the bool value readyfornextmove as true but it only moves the first time again if i press horizontal input buttons it gets stuck in the first place itself.

All i need is the move to each points when reach at paticular transform position. I know i can be done easily using Vector2.MoveToward or Lerp or rb.MovePosition. but i not interested in it. please help.

If you are certain your x will never be negative, then Your first if is causing the problem - the x pos is always > 0, so it does that and nothing else, because you are using else if in cascading conditions.

If you use that kind of logic, then you should rearrange you if statements so the smallest goes first, and from smallest to largest, with your catch all - the > 0f - goes last. You don’t even need to check the value at that point, because you know x is not less than 0.5, and not less than 1, and not less than 1.5, so just assign x without checking.

If x can be negaitve, then you need to take a different strategy with the arrangement of your logic - wrap the entire thing in your if x > 0, and leave the final else without if to assign your [0] element value.

Pseudo Example:

if( x > 0 && readyFornextmove ){  // no need readyForNextMove in enclosed if statements
   if x < 0.5 ... else if x < 1 .... else if < 1.5  ... else assign element [0]
}

There are lots of ways you could logically roll it.