Cannot assign float value?

I’m trying to store the x component of my velocity to a separate float when I ran into this strange problem. It looks quite straightforward, I did float randomVectorxModified = rb2d.velocity.x, but when I printed both in the console, I got different outputs.

  void Update()
    {
        countdown -= Time.deltaTime;
        if (countdown < 0)
        {
            PlatformMove();
            countdown = 5f;
            
        }
        Debug.Log(rb2d.velocity.x);
        Debug.Log("e"+randomVectorxModified);
    }

    void PlatformMove()
    {
        Debug.Log("MOVE");
        randomVector.Set(Random.Range(-5f,5f), Random.Range(-5f,5f));
        rb2d.velocity = randomVector;
        float randomVectorxModified = rb2d.velocity.x;
        float randomVectoryModified = -randomVector.y;
    }

In the console, it looks like randomVectorxModified was not assigned any value.

163239-annotation-2020-07-13-000223.png

It remains at 0 and I can’t think of any reason why. Shouldn’t it match the other float being printed (4.395958)? Is there something obvious I’m missing?

void PlatformMove()
{
Debug.Log(“MOVE”);
randomVector.Set(Random.Range(-5f,5f), Random.Range(-5f,5f));
rb2d.velocity = randomVector;
float randomVectorxModified = rb2d.velocity.x;
float randomVectoryModified = -randomVector.y;
}

float random Vector Modified variable is new local variable ind Platform Move() function

you can must be assigned to a member variable (in class)