Movement/Jump help

Heya guys, I’m working on a runner style games and I have the base controls down. I only need to stop the player from being able to move during the jump.

This is what I’ve gotten so far but have had little luck. :frowning:

	void Update ()
	{
		bool grounded;

		if (state != State.Hit) 
		{
			// Amount to move
			float amtToMove = Input.GetAxisRaw ("Horizontal") * PlayerSpeed * Time.deltaTime;
			
			// Move the Player
			transform.Translate (Vector3.right * amtToMove);
		
			// Wrap
			if (transform.position.x <= -6f)
				transform.position = new Vector3 (-6f, transform.position.y, transform.position.z);
			else if (transform.position.x >= 6f)
				transform.position = new Vector3 (6f, transform.position.y, transform.position.z);
			
			if (transform.position.z <= -0f)
				transform.position = new Vector3 (transform.position.x, transform.position.y, -0f);
			else if (transform.position.z >= 0f)
				transform.position = new Vector3 (transform.position.x, transform.position.y, 0f);	
		}
		
		if (Physics.Raycast (transform.position, -transform.up, 2)) 
		{
			grounded = true;			
			//reset our jump count since we hit the ground //0 for double jump
			jumpCount = 1;	
			Instantiate (DustPrefab,spawnA.position, Quaternion.identity);				
		} 
		
		else 
		{
			grounded = false;
			float amtToMove = Input.GetAxisRaw ("Horizontal") * 0.1f * Time.deltaTime;		
		}
		
		
		if (Input.GetKeyDown ("space") && (grounded || jumpCount < 1)) 
		{
			state = State.Hit;
			rigidbody.AddForce (0, 10, 0);
			rigidbody.AddRelativeForce (transform.up * jumpForce, ForceMode.Impulse);
			Instantiate (JumpPrefab, transform.position, Quaternion.identity);
			state = State.Playing;
		}		
	}

Simple add CharacterController component to your player game object, and use Move method to deal with moveing, just like in this example: Unity - Scripting API: CharacterController.Move