Variable is changing but the rotation stops rotating after a half second.

I’m just trying to get an object to rock back and forth but when I put in this code it stops moving after about a half second.

function Start () {

}

public var Amplitude =5.0;
private var RotSpeed:double;

function Update () {

RotSpeed = Mathf.Sin(Mathf.Deg2Rad*Time.time/2)*Amplitude;
transform.rotation.x=RotSpeed;

}

Can anyone tell me what’s happening?

Transform.rotation is a Quaternion. Changing the x value will not result in a correct rotation around the x-axis.
Use Transform.Rotate to rotate an object with Euler angles.