Unity 2017 character movement problem (2D)

So I’m working right now on my game for my school and I got a problem. My player is moving constantly on the X axis to the right (without pressing anything, like a endless runner) and you can switch the “lanes” threw “W” and “S”. The problem here is that I’m using for the constant running transform.Translate(1 * speed * Time.deltaTime, 0, 0f, Space.World); and for the “lane switching” I’m using: transform.position = new Vector2(38.45f, playerY);. I guess you can see the problem, everytime I press W or S the player is set back to X 38.45. I’m pretty sure there is any code so the lane switching isn’t setting the X value of the player but I don’t know what to google for that…,

Ok, I found the answer on myself. I just making this in the “void LaneSwitch()”:

    playerY = -4.15f;
    Vector2 newpos = transform.position;
    newpos.y = playerY;
    transform.position = newpos;

And that is working perfectly fine.