My attempt at making an RTS camera failed... Help?

I’m trying to make a camera simular to the one in Age of Empires where the camera scrolls when the mouse is near the edge but I cant get it to set up right on most screens…

var MouseSens = 10;
function Update(){
//Camera//
	
	var Mousex = Input.mousePosition.x;
	var Mousey = Input.mousePosition.y;
	if (Mousex < 10) {
	transform.position.x = transform.position.x - MouseSens;
	}
	if (Mousex > -10) {
	transform.position.x = transform.position.x + MouseSens;
	}
	if (Mousey < 10) {
	transform.position.z = transform.position.z - MouseSens;
	}
	if (Mousey > -10) {
	transform.position.z = transform.position.z + MouseSens;
	}
}

Can you give any more detail about exactly what is going wrong?