"Expressions in statements must only be executed for their side-effects."

I’ve searched through the forums and couldn’t find anything helped me on this one. I’m sure it’s simple enough, but it’s driving me crazy.

function PercentageMultiplier(multiplier : float){
	for(var i = 0; i<10; i++){
	multiplier + .01;
	yield WaitForSeconds(1);
	}
}

I’m getting an error on the 3rd line reading: Expressions in statements must only be executed for their side-effects. The variable exists, and if I comment that line out, it’s fine. I’ve seen people have the same error, but it seems they’ve always just set up their for loop up wrong. Any ideas?

“May only be executed for their side-effects” The operation that you want to perform will not actually do anything unless you assign it to something.

var num = multiplier + .01;

multiplier is a variable already. I’m trying to increase it in this loop. I’ve even tried inserting a different var. Example below:

function PercentageMultiplier(multiplier : float){
	for(var i = 0; i<10; i++){
	speedMultiplier + .01;
	yield WaitForSeconds(1);
	}
}

speedMulitplier is declared outside of this and I get the same result.

Yup, if you want to increase it then you need to set it equal to the result(side-effect) of the equation.

speedMultiplier = speedMultiplier + .01;

duuurrrr THANK YOU!

Using the += operator would also do it.

multiplier += .01;

var leftWheel : WheelCollider;
var rightWheel : WheelCollider;
var maxTorque= 260.0;

function Start () {

‘GetComponent y = 0’;
}

function FixedUpdate () {
leftWheel.motorTorque = maxTorque * Input.GetAxis(“Vertical”);
rightWheel.motorTorque = maxTorque * Input.GetAxis(“Vertical”);

leftWheel.steerAngle = 10 * Input.GetAxis(“Horizontal”);
rightWheel.steerAngle = 10 * Input.GetAxis(“Horizontal”);

}

I’ve the same problem. Can somebody help me?