Rotating character and object at the same time

Hey so I have the following script to move my player as long as it has a tag but I want to move another object when my player collides with a trigger.

Code:

function OnTriggerEnter(otherCollider : Collider) {
    if (otherCollider.tag == "RotationTrigger") {
        transform.Rotate(0,90,0);
    }
}

In the code provided. It shows that the object has to have a tag of "RotationTrigger" and if it does it will turn the character. I want to rotate another object thats in the scene when the player collides with the Trigger.

How would I do this?

As a bonus I want to make a variable that equals 0 so when my player walks into the trigger it will make the variable equal 1 and rotate the object and the character (like the code above). When the variable equals 0 it will rotate a different direction.

This is simple I know but I moved from torque and so i'm still learning. Hope you guys can help! thank you!

This is close to what I would like and again I'm new to scripting like this so this could be wrong.

function Spinobject() 
  { 
    if (otherCollider.tag == "RotationTrigger" && objectisspun == true)
     { transform.Rotate(0,90,0);
       var (objectname) : GameObject = GameObject.Find("objectname");                                                                                                          objectname.transform.Rotate(0,90,0);

 objectisspun = false;
 } 

else if (otherCollider.tag == "RotationTrigger" && objectisspun == false)
 { transform.Rotate(0,-90,0);
 var (object name) : GameObject = GameObject.Find("objectname"); objectname.transform.Rotate(0,-90,0);
 objectisspun = true;
   }
 }

I could be completely wrong on this but that is sort of what I would like

var objectname : GameObject = GameObject.Find("objectname");
var bRotateLeft: Boolean = false;

function OnTriggerEnter(otherCollider : Collider) {
if (otherCollider.tag == "RotationTrigger") {
    if(bRotateLeft)
    {
        bRotateLeft = false;
        transform.Rotate(0,90,0);
        objectname.transform.Rotate(0,90,0);
    }
    else
    {
        bRotateLeft = true;
        transform.Rotate(0,-90,0);
        objectname.transform.Rotate(0,-90,0);
    }
}

}

Just copied the code from the answer from the link