Rotating GameObject with transform.Rotate issue!

I just ran into another issue, I’m trying to rotate a needle to depict a speedometer, I’m getting the following error, see below:


var currentSpeed : float;
var SpeedNeedle : GameObject;

function Update () {
carsSpeed ();
Speedometer ();

function Speedometer () {
var speedFactor : float = currentSpeed;

var rotationAngle : float;

if (currentSpeed >= 0){

  rotationAngle = Mathf.Lerp(0,180,speedFactor);


  else {

  rotationAngle = Mathf.Lerp(0,180,-speedFactor);

 SpeedNeedle = transform.Rotate(0,0,rotationAngle, Space.Self);

function carsSpeed () {

//Getting current speed of the tire for engine sounds	
currentSpeed = rigidbody.velocity.magnitude * 2.237 * Time.deltaTime;

Here is the Error:


Thanks for the help

PS: I take the time to Mark and rate correct answers.

Your problem is this:
SpeedNeedle = transform.Rotate(0,0,rotationAngle, Space.Self);

SpeedNeedle is of type GameObject. If you look at the documentation for Transform.rotate, you will see that it returns void. The fix is that instead of setting it equal, you should do this: