Headbobbing

I am trying to put a headbobbing script into a sprinting script to increase the bob amount and speed and I come across it saying headbob does not denote a valid type

Sprinting code Javascript

#pragma strict
 
var walkSpeed : float = 5; // Regular speed
var sprintSpeed : float = 10; // Run speed
var bobamounta : float = 0.1; // Walking bob amount
var bobamountb : float = 0.2; // Headbobbing amount
var bobbingSpeeda = 0.1;
var bobbingSpeedb = 0.2;
private var charMotor : CharacterMotor;
private var charController : CharacterController;
private var headbob : headbob;
 
function Start () 
{
    charMotor = GetComponent(CharacterMotor);
    charController = GetComponent(CharacterController);
    headbob = GetComponent(headbob);
}
 
function Update () 
{
    //Making the actual speed var
    var speed = walkSpeed;
    
    var bobbingSpeeda = bobbingSpeedb;
    
    var bobbingAmount = bobamounta;
 
    //Checking for oppertunity to sprint
    if(charController != null)
    {
        if ( charController.isGrounded && Input.GetKey("left shift"))
        {
            //changing the speed to sprint
            speed = sprintSpeed;
            
            bobbingSpeed = bobbingSpeedb;
            
            bobbingAmount = bobamountb;
        }
    }
    else print("charController component not found.");
 
    if(charMotor != null)
        charMotor.movement.maxForwardSpeed = speed; //Setting the speed
    else print("charMotor component not found.");
}

Headbob script javascript

 private var timer = 0.0; 
 var bobbingSpeed = 0.18; 
 var bobbingAmount = 0.2; 
 var midpoint = 2.0; 
 
 function Update () { 
    waveslice = 0.0; 
    horizontal = Input.GetAxis("Horizontal"); 
    vertical = Input.GetAxis("Vertical"); 
    if (Mathf.Abs(horizontal) == 0 && Mathf.Abs(vertical) == 0) { 
       timer = 0.0; 
    } 
    else { 
       waveslice = Mathf.Sin(timer); 
       timer = timer + bobbingSpeed; 
       if (timer > Mathf.PI * 2) { 
          timer = timer - (Mathf.PI * 2); 
       } 
    } 
    if (waveslice != 0) { 
       translateChange = waveslice * bobbingAmount; 
       totalAxes = Mathf.Abs(horizontal) + Mathf.Abs(vertical); 
       totalAxes = Mathf.Clamp (totalAxes, 0.0, 1.0); 
       translateChange = totalAxes * translateChange; 
       transform.localPosition.y = midpoint + translateChange; 
    } 
    else { 
       transform.localPosition.y = midpoint; 
    } 
 }

You say “Headbob script” but you declare it in code as headbob…

do a spellcheck and make sure both are exactly identical : code is very case sensitive.

private var headbob : Headbob;