CharacterMotor does not exist in the current context

I made a script for walk ,run and idle animations for my weapon ,this script I saw on youtube and I wrote it from the video.

First I get error that CharacterMotor does not exist in the current context tho I have it in my assets.

And I get errors like

  • (34,22) error cs1525 unexpected symbol “{”
  • (42,40) error cs1519 unexpected symbol “else”
  • (44,54) error cs1519 unexpected symbol “=”
  • (44,76) error cs1519 unexpected symbol “;”
  • (45,76) error cs1519 unexpected symbol “=”
  • (45,87) error cs1519 unexpected symbol “;”
  • (46,74) error cs1519 unexpected symbol “=”
  • (46,85) error cs1519 unexpected symbol “;”
  • 47,78) error cs1519 unexpected symbol “=”
  • (47,90) error cs1519 unexpected symbol “;”
  • (49,17) error cs8025 parsing error

Really need help since I am lost I tryed to find whats wrong with these lines and couldnt solve with removing or adding the symbols ,need someones help ,especialy with CharacterMotor problem ,since I dont understand how it cannot exist.

Also I have the same problem with SpeedController like with CharacterMotor.

Thanks

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour 

{
		public CharacterController CharCont;
		
	    public CharacterMotor CharMotor;

	// Holder for weapons
	public Transform WalkAnimationHolder;
	public Transform JumpAnimationHolder;
	public Transform SwayAnimationHolder;
	public Transform RecoilAnimationHolder;

	public WalkingState walkingstate = WalkingState.Idle;

		public float VelocityMagnitude;

		public float WalkSpeed;
		public float RunSpeed;

	public void FixedUpdate() 
	{
		AnimationController();
		SwayController();
		SpeedController();
	    VelocityMagnitude = CharCont.velocity.magnitude;
	}
	public void SpeedControler()
	{
			if ((Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) && VelocityMagnitude > 0)
		     {
				if (Input.GetButton("Run"))
				{
					walkingstate = WalkingState.Running;
					CharMotor.movement.maxForwardSpeed = RunSpeed;
					CharMotor.movement.SidewaysSpeed = RunSpeed;
					CharMotor.movement.maxBackwardsSpeed = RunSpeed / 2;
				}
				    else
				{
					walkingstate = WalkingState.Walking;
					CharMotor.movement.maxForwardSpeed = WalkSpeed;
					CharMotor.movement.SidewaysSpeed = WalkSpeed;
					CharMotor.movement.maxBackwardsSpeed = WalkSpeed / 2;
				}
		    }
			        else

			{
				    walkingstate = WalkingState.Idle;
			}
	}

	public void AnimationController() 
	{
				if (walkingstate == WalkingState.Running)
				{
					WalkAnimationHolder.animation["RUN ANIMATION"].speed = VelocityMagnitude / RunSpeed;
					WalkAnimationHolder.animation.CrossFade("RUN ANIMATION" , 0.2f);
				}
				else if (walkingstate == WalkingState.Walking)
				{
					WalkAnimationHolder.animation["RUN ANIMATION"].speed = VelocityMagnitude / WalkSpeed;
					WalkAnimationHolder.animation.CrossFade("WALK ANIMATION" , 0.2f);
				}
				else
				{
					WalkAnimationHolder.animation.CrossFade("IDLE ANIMATION" , 0.2f);
				}
	}

	public void SwayController()
	{

	}
}

    public enum WalkingState 
{
	Idle,
	Walking,
	Running
}

I believe CharMotor is JS while this is C#; search UA/Google for any of the hundreds of posts on that issue.