Stop transform.rotation by mouse click

Hello!

I got a little script problem with my unity game and i need your help, becasue i can’t solved that.
I’ve checked many unity forums, but i couldn’t find the solution. Please don’t laugh at me 'cause is so easy.
So, I want to stop a rotation by mouse click. That’s it.

#pragma strict



function Update (){

{
transform.Rotate(0,0,4);
}

if(Input.GetMouseButton(0))

{
transform.Rotate(0,0,0);
}

}

Hi @uzsika!

You can do the following:

var speed = 4;

function Update()
{

transform.Rotate(0,0,speed);

if(Input.GetMouseButton(0))
{
speed=0;
}
}

Thank you so much !!!