'Making a movement function for 2d unity game

So basically im programming a 2d game in unity using c# and i made a movement function as follows:

void PlayerMove(){
    movementX = Input.GetAxisRaw("Horizontal");

    transform.position += new Vector3(movementX, 0f, 0f) * Time.deltaTime * MovementSpeed;

}

then i call it in update() and this worked before but now that i got on my laptop using only the laptop keyboard it wont work, and i dont think its the laptop sending the keys weird or something like that since services like what key am i pressing works. Does anyone know what im doing wrong ive looked through it and im not getting any compiler errors.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source