How to tell the game if the player is not moving

Currently, I am trying to create a 2D runner. The ground in this infinite runner moves to the left, and when it gets off screen, I’ve written a script to cause it to move back to the far right of the screen. The ground has a collider on it to allow the player to stand on it, but whenever the player stands on this ground, he does not slide to the left with the ground. To solve this problem, I’ve decided that the best thing to do would be to make the player move to the left at the same speed as the ground. The thing with this is that I want the player to move to the left only when the player is not making any movement inputs.

So, if I want to tell the game, “Only move the player to the left when the player is not making any inputs”,
how would I do this? If anyone can help, it would be greatly appreciated.

try something like

 bool playerIsMoving
 if (Input.anyKeyDown == true) 
 {
      playerIsMoving = false;
 }
 else 
 {
      playerIsMoving = true;
 }

Input.anyKeyDown basically just checks if there is any input being made, like a mouse click or keyboard button click

hope this helped