how do i check if the player stop moving/decrease speed/stop moving distance so i could stop the scroll animation background at the back.

i have a 2d game with this problem taking up all the time… i know its simple to you guys. but i cant seem to find a way to check so i could stop the animation of the background, ive used GM.Player.rigidbody2d.velocity.magnitude == 0, initialdistance > distance, and many more… i probably am doing something wrong with my code…can anyone help me?

this is the code for the background scrolling.

public class ScrollMidBackground : MonoBehaviour {
	public float speed = 0.03f;
	private GameManager GM;
	private float initialDistance = 0f;
	
	void Start()
	{
		GM = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameManager> ();
	}
	void FixedUpdate () 
	{
			if(GM.taptostart==true)
			{
					transform.Translate (speed*-1, 0 , 0);
			}


		if(GM.isGameOver)
		{
			speed = 0.0f;
		}

	}
}

// ive deleted all the codes concerning on stopping the movement with the use of my previous codes above.

For some reason I can’t comment on your question so I’m going to have to post this as an answer, but here’s a video that might help you. I’m not sure if it will, but it’s worth a shot Revisiting 2D Parallax Scrolling Backgrounds in Unity - YouTube

thanks but the tutorial is a runner, not an infinite runner. and he uses an Input mouse button to check… mine doesn’t since it runs infinitely and the only Input it uses is to jump.
thanks again for your quick response