How do I make an object orbit another object

Someone on here said use the transform.RotateAround() but that’s all the hints they gave to another user. Since I am new to scripting entirely I’m finding it difficult to put the pieces together on my own. When I think I’m starting to grasp it, I try it out and it pops up a ton of red errors.

like the example script in Unity’s reference.
transform.RotateAround (Vector3.zero, Vector3.up, 20 * Time.deltaTime);
that works well to rotate the object around the whole world, but I want it to orbit an object, so I tried adding the orbiting object as a child of the object I wanted it to orbit and then gave the child object the follow script to follow the main object but it just sat there, and didn’t move at all.

also I didn’t understand the script supplied in reference because

transform.RotateAround is the function right? and then the options are (Vector3.zero, Vector.up, 20 * Time.deltaTime);

so I thought, the three things are the vector3? (x,y,z) and so setting it to (2,5,20); would tell it to rotate around in a chaotic orbit, but instead it just yelled at me and said it didn’t understand what I was trying to tell it.

Looks like you need a kind of point gravitation, which can be better done with forces like this (my noob-version could for sure done more elegant):

var GravIntensity : float = 1;
function OnTriggerStay (other : Collider) {
       if (other.attachedRigidbody) {
          var dist = Vector3.Distance(gameObject.transform.position , other.transform.position);
          other.attachedRigidbody.AddForce( (gameObject.transform.position - other.transform.position)/dist/dist*GravIntensity);
       }
    }                              

Put the script to the attracting objects and give them a trigger-sphere. Then
all objects within the “GravitationSphere”(for reducing the calculation needed) with a physical body (ridgetbody) will be attraced. Hope it helps.