[JS] transform.rotation not working

Hi Everybody!
I’m creating a project for training (i’m a beginner) but i can’t rotate correctly ma player. I’ve tried with X, Y and Z axis, but nothing. It rotates every time in the wrong direction… Can u help me?
Thanks

Here is the code:

#pragma strict

var RotSpeed : float;
var rotOffsetX : float;
var Head : Transform;

function Start () {

}

function Update () {
	/*	Mouse X	, PLAYER ROT, THE WRONG ROTATION! I've TRIED WITH Y,Z and X Axis, but it doesn't turn left/right*/
	transform.rotation.y += RotSpeed * Time.deltaTime * Input.GetAxis("Mouse X");
	
	
	/*	Mouse Y, HEAD, the working code	*/
	
	
		Head.localRotation.x += RotSpeed * Time.deltaTime * Input.GetAxis("Mouse Y");
	
	
}