- Home /
 
Expressions in statements must only be executed for their side-effects.
Hey everyone.
So I was writing this really long script(some parts copied other self written) to make a tank move with the correct physics and such, when I came across the error above. I know that the error means I don't need a certain part of it or that it's not being used/called. But I can't seem to find the issue!
Here's the script(only showing the part where the error is but willing to post it all if needed):
function (currentForwardFriction : float , currentSidewayFriction : float)
  {
         wheelL1.forwardFriction.stiffness = currentForwardFriction;
         wheelL2.forwardFriction.stiffness = currentForwardFriction;
         wheelL3.forwardFriction.stiffness = currentForwardFriction;
         wheelL4.forwardFriction.stiffness = currentForwardFriction;
         wheelL5.forwardFriction.stiffness = currentForwardFriction;
         wheelL6.forwardFriction.stiffness = currentForwardFriction;
         wheelL7.forwardFriction.stiffness = currentForwardFriction;
         wheelL8.forwardFriction.stiffness = currentForwardFriction;
         wheelR1.forwardFriction.stiffness = currentForwardFriction;
         wheelR2.forwardFriction.stiffness = currentForwardFriction;
         wheelR3.forwardFriction.stiffness = currentForwardFriction;
         wheelR4.forwardFriction.stiffness = currentForwardFriction;
         wheelR5.forwardFriction.stiffness = currentForwardFriction;
         wheelR6.forwardFriction.stiffness = currentForwardFriction;
         wheelR7.forwardFriction.stiffness = currentForwardFriction;
         wheelR8.forwardFriction.stiffness = currentForwardFriction;
         wheelL1.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL2.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL3.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL4.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL5.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL6.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL7.sidewayFriction.stiffness = currentSidewayFriction;
         wheelL8.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR1.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR2.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR3.sidewaysFriction.stiffness = currentSidewayFriction;
         wheelR4.sidewaysFriction.stiffness = currentSidewayFriction;
         wheelR5.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR6.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR7.sidewayFriction.stiffness = currentSidewayFriction;
         wheelR8.sidewayFriction.stiffness = currentSidewayFriction;
     }
 
              Well how do you want to call a function if it has no name?
change
 function (currentForwardFriction : float , currentSidewayFriction : float)
 
                  to
 function myFunctionName(currentForwardFriction : float , currentSidewayFriction : float)
 
                  and next time delete the empty codlines - my scroll wheel is not working atm ;)
If I do that I get another error, are you sure I can just pop in myFunctionName? The new error is expecting '(' found 'myFunctionName'
well yes. But if you have troubles finding out how to script a function see this post and scroll down to functions (where the entire post is useful)
you probably have a typo in the function definition or at the point you call the function. How does it look like now?
I'm more lost then I was when I started! The only error that I know of is this line...But when I add the myFunctionName I get several more errors. If and when I add the myFunctionName, do I have to put it earlier in the script as well? or what? please help/explain! Thanks!
function definitions:
 function Update()
 {
    // do something
    myFunctionName(1.0f, 1.0f);   // this actually calls the function
 }
 
 function myFunctionName(currentForwardFriction : float , currentSidewayFriction : float)
 {
    // the code in your function
 }
 
                 Answer by nadeemd · Jul 18, 2013 at 07:02 PM
 //Mine
 var wheelL1: WheelCollider;
 
 
 var wheelL2: WheelCollider;
 
 
 var wheelL3: WheelCollider;
 
 
 var wheelL4: WheelCollider;
 
 
 var wheelL5: WheelCollider;
 
 
 var wheelL6: WheelCollider;
 
 
 var wheelL7: WheelCollider;
 
 
 var wheelL8: WheelCollider;
 
 
 var wheelR1: WheelCollider;
 
 
 var wheelR2: WheelCollider;
 
 
 var wheelR3: WheelCollider;
 
 
 var wheelR4: WheelCollider;
 
 
 var wheelR5: WheelCollider;
 
 
 var wheelR6: WheelCollider;
 
 
 var wheelR7: WheelCollider;
 
 
 var wheelR8: WheelCollider;
 
 
 var wheelL1Trans: Transform;
 
 
 var wheelL2Trans: Transform;
 
 
 var wheelL3Trans: Transform;
 
 
 var wheelL4Trans: Transform;
 
 
 var wheelL5Trans: Transform;
 
 
 var wheelL6Trans: Transform;
 
 
 var wheelL7Trans: Transform;
 
 
 var wheelL8Trans: Transform;
 
 
 var wheelR1Trans: Transform;
 
 
 var wheelR2Trans: Transform;
 
 
 var wheelR3Trans: Transform;
 
 
 var wheelR4Trans: Transform;
 
 
 var wheelR5Trans: Transform;
 
 
 var wheelR6Trans: Transform;
 
 
 var wheelR7Trans: Transform;
 
 
 var wheelR8Trans: Transform;
 
 
 var lowestSteerAtSpeed: float = 50;
 
 
 var lowSpeedSteerAngel: float = 10;
 
 
 var highSpeedSteerAngel: float = 1;
 
 
 var decellarationSpeed: float = 30;
 
 
 var maxTorque: float = 50;
 
 
 var currentSpeed: float;
 
 
 var topSpeed: float = 150;
 
 
 var maxReverseSpeed: float = 50;
 
 
 var backLightObject: GameObject;
 
 
 var idleLightMaterial: Material;
 
 
 var brakeLightMaterial: Material;
 
 
 var reverseLightMaterial: Material;
 
 
 private
 var braked: boolean = false;
 
 
 var maxBrakeTorque: float = 100;
 
 
 private
 var mySidewayFriction: float;
 
 
 private
 var myForwardFriction: float;
 
 
 private
 var slipSidewayFriction: float;
 
 
 private
 var slipForwardFriction: float;
 
 
 var speedOMeterDial: Texture2D;
 
 
 var speedOMeterPointer: Texture2D;
 
 
 
 
 
 var gearRatio: int[];
 
 
 function SetValues() {
 
 
     myForwardFriction = wheelL1.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelL2.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelL3.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelL4.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelL5.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelL6.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelL7.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelL8.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelR1.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelR2.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelR3.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelR4.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelR5.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelR6.sidewaysFriction.stiffness;
 
 
     myForwardFriction = wheelR7.forwardFriction.stiffness;
 
 
     mySidewayFriction = wheelR8.sidewaysFriction.stiffness;
 
     slipForwardFriction = 0.05;
 
 
     slipSidewayFriction = 0.085;
 
 
 }
 
 
 
 
 
 function FixedUpdate() {
 
 
     Controle();
 
 
     HandBrake();
 
 
 }
 
 
 function Update() {
 
 
     wheelL1Trans.Rotate(wheelL1.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL2Trans.Rotate(wheelL2.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL3Trans.Rotate(wheelL3.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL4Trans.Rotate(wheelL4.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL5Trans.Rotate(wheelL5.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL6Trans.Rotate(wheelL6.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL7Trans.Rotate(wheelL7.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelL8Trans.Rotate(wheelL8.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR1Trans.Rotate(wheelR1.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR2Trans.Rotate(wheelR2.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR3Trans.Rotate(wheelR3.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR4Trans.Rotate(wheelR4.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR5Trans.Rotate(wheelR5.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR6Trans.Rotate(wheelR6.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR7Trans.Rotate(wheelR7.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
     wheelR8Trans.Rotate(wheelR8.rpm / 60 * 360 * Time.deltaTime, 0, 0);
 
 
 
     BackLight();
 
 
     WheelPosition();
 
 }
 
 
 function Controle() {
 
 
     currentSpeed = 2 * 22 / 7 * wheelL1.radius * wheelL1.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL2.radius * wheelL2.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL3.radius * wheelL3.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL4.radius * wheelL4.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL5.radius * wheelL5.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL6.radius * wheelL6.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL7.radius * wheelL7.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelL8.radius * wheelL8.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR1.radius * wheelR1.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR2.radius * wheelR2.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR3.radius * wheelR3.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR4.radius * wheelR4.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR5.radius * wheelR5.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR6.radius * wheelR6.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR7.radius * wheelR7.rpm * 60 / 1000;
 
     currentSpeed = 2 * 22 / 7 * wheelR8.radius * wheelR8.rpm * 60 / 1000;
 
 
     currentSpeed = Mathf.Round(currentSpeed);
 
 
     if (currentSpeed < topSpeed && currentSpeed > -maxReverseSpeed && !braked) {
 
 
         wheelL1.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL2.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL3.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL4.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL5.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL6.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL7.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelL8.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR1.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR2.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR3.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR4.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR5.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR6.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR7.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
 
         wheelR8.motorTorque = maxTorque * Input.GetAxis("Vertical");
 
     } else {
 
 
         wheelL1.motorTorque = 0;
 
 
         wheelL2.motorTorque = 0;
 
 
         wheelL3.motorTorque = 0;
 
 
         wheelL4.motorTorque = 0;
 
 
         wheelL5.motorTorque = 0;
 
 
         wheelL6.motorTorque = 0;
 
 
         wheelL7.motorTorque = 0;
 
 
         wheelL8.motorTorque = 0;
 
 
         wheelR1.motorTorque = 0;
 
 
         wheelR2.motorTorque = 0;
 
 
         wheelR3.motorTorque = 0;
 
 
         wheelR4.motorTorque = 0;
 
 
         wheelR5.motorTorque = 0;
 
 
         wheelR6.motorTorque = 0;
 
 
         wheelR7.motorTorque = 0;
 
 
         wheelR8.motorTorque = 0;
 
     }
 
 
     if (Input.GetButton("Vertical") == false) {
 
 
         wheelL1.brakeTorque = decellarationSpeed;
 
 
         wheelL2.brakeTorque = decellarationSpeed;
 
 
         wheelL3.brakeTorque = decellarationSpeed;
 
 
         wheelL4.brakeTorque = decellarationSpeed;
 
 
         wheelL5.brakeTorque = decellarationSpeed;
 
 
         wheelL6.brakeTorque = decellarationSpeed;
 
 
         wheelL7.brakeTorque = decellarationSpeed;
 
 
         wheelL8.brakeTorque = decellarationSpeed;
 
 
         wheelR1.brakeTorque = decellarationSpeed;
 
 
         wheelR2.brakeTorque = decellarationSpeed;
 
 
         wheelR3.brakeTorque = decellarationSpeed;
 
 
         wheelR4.brakeTorque = decellarationSpeed;
 
 
         wheelR5.brakeTorque = decellarationSpeed;
 
 
         wheelR6.brakeTorque = decellarationSpeed;
 
 
         wheelR7.brakeTorque = decellarationSpeed;
 
 
         wheelR8.brakeTorque = decellarationSpeed;
 
 
     } else {
 
 
         wheelL1.brakeTorque = 0;
 
 
         wheelL2.brakeTorque = 0;
 
 
         wheelL3.brakeTorque = 0;
 
 
         wheelL4.brakeTorque = 0;
 
 
         wheelL5.brakeTorque = 0;
 
 
         wheelL6.brakeTorque = 0;
 
 
         wheelL7.brakeTorque = 0;
 
 
         wheelL8.brakeTorque = 0;
 
 
         wheelR1.brakeTorque = 0;
 
 
         wheelR2.brakeTorque = 0;
 
 
         wheelR3.brakeTorque = 0;
 
 
         wheelR4.brakeTorque = 0;
 
 
         wheelR5.brakeTorque = 0;
 
 
         wheelR6.brakeTorque = 0;
 
 
         wheelR7.brakeTorque = 0;
 
 
         wheelR8.brakeTorque = 0;
 
     }
 
 
     var speedFactor = rigidbody.velocity.magnitude / lowestSteerAtSpeed;
 
 
     var currentSteerAngel = Mathf.Lerp(lowSpeedSteerAngel, highSpeedSteerAngel, speedFactor);
 
 
     currentSteerAngel *= Input.GetAxis("Horizontal");
 
 
 }
 
 function BackLight() {
 
 
     if (currentSpeed > 0 && Input.GetAxis("Vertical") < 0 && !braked) {
 
 
         backLightObject.renderer.material = brakeLightMaterial;
 
 
     } else if (currentSpeed < 0 && Input.GetAxis("Vertical") > 0 && !braked) {
 
 
         backLightObject.renderer.material = brakeLightMaterial;
 
 
     } else if (currentSpeed < 0 && Input.GetAxis("Vertical") < 0 && !braked) {
 
 
         backLightObject.renderer.material = reverseLightMaterial;
 
 
     } else if (!braked) {
 
 
         backLightObject.renderer.material = idleLightMaterial;
 
 
     }
 
 
 }
 
 
 function WheelPosition() {
 
 
     var hit: RaycastHit;
 
 
     var wheelPos: Vector3;
 
 
 
 
 
 
     //RL
 
 
 
     if (Physics.Raycast(wheelL1.transform.position, -wheelL1.transform.up, hit, wheelL1.radius + wheelL1.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL1.transform.up * wheelL1.radius;
 
 
     } else {
 
 
         wheelPos = wheelL1.transform.position - wheelL1.transform.up * wheelL1.suspensionDistance;
 
 
     }
 
 
     wheelL1Trans.position = wheelPos;
 
     if (Physics.Raycast(wheelL2.transform.position, -wheelL2.transform.up, hit, wheelL2.radius + wheelL2.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL2.transform.up * wheelL2.radius;
 
 
     } else {
 
 
         wheelPos = wheelL2.transform.position - wheelL1.transform.up * wheelL2.suspensionDistance;
 
 
     }
 
 
     wheelL2Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelL3.transform.position, -wheelL3.transform.up, hit, wheelL3.radius + wheelL3.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL3.transform.up * wheelL3.radius;
 
 
     } else {
 
 
         wheelPos = wheelL3.transform.position - wheelL3.transform.up * wheelL3.suspensionDistance;
 
 
     }
 
 
     wheelL3Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelL4.transform.position, -wheelL4.transform.up, hit, wheelL1.radius + wheelL4.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL1.transform.up * wheelL4.radius;
 
 
     } else {
 
 
         wheelPos = wheelL4.transform.position - wheelL4.transform.up * wheelL4.suspensionDistance;
 
 
     }
 
 
     wheelL4Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelL5.transform.position, -wheelL5.transform.up, hit, wheelL5.radius + wheelL5.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL5.transform.up * wheelL5.radius;
 
 
     } else {
 
 
         wheelPos = wheelL5.transform.position - wheelL5.transform.up * wheelL5.suspensionDistance;
 
 
     }
 
 
     wheelL5Trans.position = wheelPos;
 
     if (Physics.Raycast(wheelL6.transform.position, -wheelL6.transform.up, hit, wheelL6.radius + wheelL6.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL6.transform.up * wheelL6.radius;
 
 
     } else {
 
 
         wheelPos = wheelL6.transform.position - wheelL6.transform.up * wheelL6.suspensionDistance;
 
 
     }
 
 
     wheelL6Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelL7.transform.position, -wheelL7.transform.up, hit, wheelL7.radius + wheelL7.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL7.transform.up * wheelL7.radius;
 
 
     } else {
 
 
         wheelPos = wheelL7.transform.position - wheelL7.transform.up * wheelL7.suspensionDistance;
 
 
     }
 
 
     wheelL7Trans.position = wheelPos;
 
     if (Physics.Raycast(wheelL8.transform.position, -wheelL8.transform.up, hit, wheelL8.radius + wheelL8.suspensionDistance)) {
 
 
         wheelPos = hit.point + wheelL8.transform.up * wheelL8.radius;
 
 
     } else {
 
 
         wheelPos = wheelL8.transform.position - wheelL8.transform.up * wheelL8.suspensionDistance;
 
 
     }
 
 
     wheelL8Trans.position = wheelPos;
     //RR
 
 
 
 
 
     if (Physics.Raycast(wheelR1.transform.position, -wheelR1.transform.up, hit, wheelR1.radius + wheelR1.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR1.transform.up * wheelR1.radius;
 
 
     } else {
 
 
         wheelPos = wheelR1.transform.position - wheelR1.transform.up * wheelR1.suspensionDistance;
 
 
     }
 
     wheelR1Trans.position = wheelPos;
 
     if (Physics.Raycast(wheelR2.transform.position, -wheelR2.transform.up, hit, wheelR2.radius + wheelR2.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR2.transform.up * wheelR2.radius;
 
 
     } else {
 
 
         wheelPos = wheelR2.transform.position - wheelR2.transform.up * wheelR2.suspensionDistance;
 
 
     }
 
     wheelR2Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR3.transform.position, -wheelR3.transform.up, hit, wheelR3.radius + wheelR3.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR3.transform.up * wheelR3.radius;
 
 
     } else {
 
 
         wheelPos = wheelR3.transform.position - wheelR3.transform.up * wheelR3.suspensionDistance;
 
 
     }
 
     wheelR3Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR4.transform.position, -wheelR4.transform.up, hit, wheelR4.radius + wheelR4.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR4.transform.up * wheelR4.radius;
 
 
     } else {
 
 
         wheelPos = wheelR4.transform.position - wheelR4.transform.up * wheelR4.suspensionDistance;
 
 
     }
 
     wheelR4Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR5.transform.position, -wheelR5.transform.up, hit, wheelR5.radius + wheelR5.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR5.transform.up * wheelR5.radius;
 
 
     } else {
 
 
         wheelPos = wheelR5.transform.position - wheelR5.transform.up * wheelR5.suspensionDistance;
 
 
     }
 
     wheelR5Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR6.transform.position, -wheelR6.transform.up, hit, wheelR6.radius + wheelR6.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR6.transform.up * wheelR6.radius;
 
 
     } else {
 
 
         wheelPos = wheelR6.transform.position - wheelR6.transform.up * wheelR6.suspensionDistance;
 
 
     }
 
     wheelR6Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR7.transform.position, -wheelR7.transform.up, hit, wheelR7.radius + wheelR7.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR7.transform.up * wheelR7.radius;
 
 
     } else {
 
 
         wheelPos = wheelR7.transform.position - wheelR7.transform.up * wheelR7.suspensionDistance;
 
 
     }
 
     wheelR7Trans.position = wheelPos;
 
 
     if (Physics.Raycast(wheelR8.transform.position, -wheelR8.transform.up, hit, wheelR8.radius + wheelR8.suspensionDistance)) {
 
         wheelPos = hit.point + wheelR8.transform.up * wheelR8.radius;
 
 
     } else {
 
 
         wheelPos = wheelR8.transform.position - wheelR8.transform.up * wheelR8.suspensionDistance;
 
 
     }
 
     wheelR8Trans.position = wheelPos;
 
 
 }
 
 
 function HandBrake() {
 
 
     if (Input.GetButton("Jump")) {
 
 
         braked = true;
 
 
     } else {
 
 
         braked = false;
 
 
     }
 
 
     if (braked) {
 
 
         if (currentSpeed > 1) {
 
 
             wheelL1.motorTorque = 0;
 
 
             wheelL2.motorTorque = 0;
 
 
             wheelL3.motorTorque = 0;
 
 
             wheelL4.motorTorque = 0;
 
 
             wheelL5.motorTorque = 0;
 
 
             wheelL6.motorTorque = 0;
 
 
             wheelL7.motorTorque = 0;
 
 
             wheelL8.motorTorque = 0;
 
 
             wheelR1.motorTorque = 0;
 
 
             wheelR2.motorTorque = 0;
 
 
             wheelR3.motorTorque = 0;
 
 
             wheelR4.motorTorque = 0;
 
 
             wheelR5.motorTorque = 0;
 
 
             wheelR6.motorTorque = 0;
 
 
             wheelR7.motorTorque = 0;
 
 
             wheelR8.motorTorque = 0;
 
 
 
         } else if (currentSpeed < 0) {
 
 
             wheelL1.brakeTorque = maxBrakeTorque;
 
 
             wheelL2.brakeTorque = maxBrakeTorque;
 
 
             wheelL3.brakeTorque = maxBrakeTorque;
 
 
             wheelL4.brakeTorque = maxBrakeTorque;
 
 
             wheelL5.brakeTorque = maxBrakeTorque;
 
 
             wheelL6.brakeTorque = maxBrakeTorque;
 
 
             wheelL7.brakeTorque = maxBrakeTorque;
 
 
             wheelL8.brakeTorque = maxBrakeTorque;
 
 
             wheelR1.brakeTorque = maxBrakeTorque;
 
 
             wheelR2.brakeTorque = maxBrakeTorque;
 
 
             wheelR3.brakeTorque = maxBrakeTorque;
 
 
             wheelR4.brakeTorque = maxBrakeTorque;
 
 
             wheelR5.brakeTorque = maxBrakeTorque;
 
 
             wheelR6.brakeTorque = maxBrakeTorque;
 
 
             wheelR7.brakeTorque = maxBrakeTorque;
 
 
             wheelR8.brakeTorque = maxBrakeTorque;
 
 
             wheelL1.motorTorque = 0;
 
 
             wheelL2.motorTorque = 0;
 
 
             wheelL3.motorTorque = 0;
 
 
             wheelL4.motorTorque = 0;
 
 
             wheelL5.motorTorque = 0;
 
 
             wheelL6.motorTorque = 0;
 
 
             wheelL7.motorTorque = 0;
 
 
             wheelL8.motorTorque = 0;
 
 
             wheelR1.motorTorque = 0;
 
 
             wheelR2.motorTorque = 0;
 
 
             wheelR3.motorTorque = 0;
 
 
             wheelR4.motorTorque = 0;
 
 
             wheelR5.motorTorque = 0;
 
 
             wheelR6.motorTorque = 0;
 
 
             wheelR7.motorTorque = 0;
 
 
             wheelR8.motorTorque = 0;
 
 
 
 
         } else {
 
 
 
         }
 
 
         if (currentSpeed < 1 && currentSpeed > -1) {
 
 
             backLightObject.renderer.material = idleLightMaterial;
 
 
         } 
         else {
 
 
             backLightObject.renderer.material = brakeLightMaterial;
 
 
         }
 }
         
      function (currentForwardFriction : float , currentSidewayFriction : float)
      
      {
 
 
             wheelL1.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL2.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL3.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL4.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL5.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL6.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL7.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL8.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR1.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR2.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR3.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR4.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR5.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR6.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR7.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelR8.forwardFriction.stiffness = currentForwardFriction;
 
 
             wheelL1.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL2.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL3.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL4.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL5.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL6.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL7.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelL8.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR1.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR2.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR3.sidewaysFriction.stiffness = currentSidewayFriction;
 
 
             wheelR4.sidewaysFriction.stiffness = currentSidewayFriction;
 
 
             wheelR5.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR6.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR7.sidewayFriction.stiffness = currentSidewayFriction;
 
 
             wheelR8.sidewayFriction.stiffness = currentSidewayFriction;
 
         };
 
 
     
 }
 
              HOLLY COW!!! That is a HUGE script! Thankfully I am not dealing with tanks.
Your answer
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
error in code (Please help) 1 Answer
BCE0044: Expecting : Found = Error! 2 Answers