puzzle with rotating statues

Hello everyone , I’m working on a Unity game and I’m seeking help , i’ve begun a game with Unity3D which you can try here http://ns14.freeheberg.com/~anykey2/Test1/WebPlayer/WebPlayer.html

I’d like to include some puzzles , I’ve begun with a puzzle that seems easy to do , but it’s actually very hard for me (I’m a weak programmer)
I’d like to put some kind of statues that you must rotate with buttons on the ground until they are all at y=0 (they face the camera all in the same direction) so it opens a gate.
Here is what my script looks like , but it really doesn’t work
a little precision , i’d like to use Rotate , not rotation to have slow and realistic rotations.

var Statue : GameObject;
var Porte : GameObject;
var RotationLimit =0;
static var StatuePoint = 0;
function Update () {
if (Statue.transform.rotation.y > 360){
Statue.transform.rotation.y = 0;
}
if (RotationLimit == 4){
RotationLimit = 0;
}
if (Statue.transform.rotation.y == 90){
RotationLimit = 1;
}
if (Statue.transform.rotation.y == 180){
RotationLimit = 2;
}
if (Statue.transform.rotation.y == 270){
RotationLimit = 3;
}
if (Statue.transform.rotation.y == 0){
RotationLimit = 0;
}
if (RotationLimit == 0){
++ StatuePoint;
}
print(RotationLimit);
}

function OnTriggerStay (other : Collider) {
if (other.gameObject.tag == "Boite" && RotationLimit == 0 && Statue.transform.rotation.y <= 90 && Statue.transform.rotation.y >= 0){
Statue.transform.Rotate(0,5,0);
}
if (other.gameObject.tag == "Boite" && RotationLimit == 1 && Statue.transform.rotation.y <= 180 && Statue.transform.rotation.y >= 90){
Statue.transform.Rotate(0,5,0);
}
if (other.gameObject.tag == "Boite" && RotationLimit == 2 && Statue.transform.rotation.y <= 270 && Statue.transform.rotation.y >= 180){
Statue.transform.Rotate(0,5,0);
}
if (other.gameObject.tag == "Boite" && RotationLimit == 3 && Statue.transform.rotation.y <= 360.1 && Statue.transform.rotation.y >= 270){
Statue.transform.Rotate(0,5,0);
}
}
function OnTriggerExit (other : Collider) {
RotationLimit = RotationLimit +1 ;
}

Your logic is basically correct, except that you increase StatuePoint ever frame and never decrease it. I assume that’s supposed to be a counter of how many are correctly positioned.