Vertical Slider as rotater

Hello everyone, Im trying to rotate a Cannon of a ship for aiming adjustment. I tried first using the eulerAngle adjustment but it didn't work, the whole angles and quaternion still confuses me. :(

here's my current code:

public Transform leftCannons; // the actual cannon
public float leftCannonAngle = 0.0f; // the rotation of cannon
//On GUI area

leftCannonAngle = GUI.VerticalSlider (new Rect (250, 5, 10, 50), leftCannonAngle, 0.0f, 10.0f);
leftCannons.transform.Rotate(Vector3.forward, leftCannonAngle);

as you can see in the code i want to limit the rotation of the cannon between 0 deg and 10 deg of the z-axis.

tranform.Rotate() does not set the rotation, it rotates the current transform by a value. If you want to force the z-axis rotation to be always the value of your slider, you could do:

Vector3 angles=leftCannons.localEulerAngles;
angles.z=leftCannonAngle;
leftCannons.localEulerAngles=angles;

(Note that since leftCannons is already of type Transform you don't need to write leftCannons.transform)