Crosshairs change when sprinting?

This script adds a crosshair texture in the middle of my screen and then hides it if the right mouse button is being held down. Im trying to change the crosshair when the player is sprinting, but Im not sure what to put in my update, can anyone help me out?

var crosshairTexture : Texture2D;
var sprintCrosshairTexture : Texture2D;
var position : Rect;
var rightClick : boolean = true;

 function Start(){



        position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height );

}



function Update() {



if(Input.GetButtonDown("left shift")){

  //texture change to sprint texture

}



if(Input.GetButtonUp("left shift")){

  //texture change back to normal texture

}

  



if(Input.GetMouseButtonDown(1)){

      rightClick = false;

  }

  

  if(Input.GetMouseButtonUp(1)){

      rightClick = true;

  }

}





function OnGUI(){

if(rightClick){

    GUI.DrawTexture(position, crosshairTexture);    

}

}

Something like

function Update() {

if(Input.GetButtonDown("left shift")){

   position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width * 2, crosshairTexture.height * 2 );

}

if(Input.GetButtonUp("left shift")){

   position = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height );

}

OK try this …

    var crosshairTextureBig : Texture2D;
    var crosshairTexture : Texture2D;
    var sprintCrosshairTexture : Texture2D;
    var position1 : Rect;
    var position2 : Rect;
    var rightClick : boolean = true;
    var shiftButton : boolean = fasle;
    
     function Start(){
    
    
    
            position1 = Rect( ( Screen.width - crosshairTexture.width ) / 2, ( Screen.height - crosshairTexture.height ) / 2, crosshairTexture.width, crosshairTexture.height );
    
            position2 = Rect( ( Screen.width - crosshairTextureBig.width ) / 2, ( Screen.height - crosshairTextureBig.height ) / 2, crosshairTextureBig.width, crosshairTextureBig.height );
    
    }
    
    
    
    function Update() {
    
    
    
    if(Input.GetButtonDown("left shift")){
    
      shiftButton = true;
    
    }
    
    
    
    if(Input.GetButtonUp("left shift")){
    
      shiftButton = false;
    
    }
    
    
    
    
    
    if(Input.GetMouseButtonDown(1)){
    
          rightClick = false;
    
      }
    
    
    
      if(Input.GetMouseButtonUp(1)){
    
          rightClick = true;
    
      }
    
    }
    
    
    
    
    
    function OnGUI(){

if(rightClick){

    GUI.DrawTexture(position1, crosshairTexture);    
    }

if(shiftButton){

GUI.DrawTexture(position2, crosshairTextureBig);
rightClick = false;
    }

if(!shiftButton){

GUI.DrawTexture(position1, crosshairTexture); 
    }
}

Please give me the sprint code :slight_smile: