Stopping object rotating at a certain rotation

So ive got a player(that can flip using “a” and “d”) with an arm, and that arm rotates to point at the mouse. However the arm can rotate all the way around so that it is sticking out of the players back. Therefore i need to stop the arm rotating at a certain point and then allow it to rotate back into an “allowed” area.

Any help would be appreciated.


@Adsothegreat you can use code like: if (transform.rotation.x > maxrotation) { transform.rotation.x = maxrotation } in the Update ()