transform.rotatearound

am using the rotateAround function to make a sphere orbit around my player. it works fine when the player is still, but if i move my player the orbit radius gets bigger or smaller according to the movement.below is the script what i used. need help to know why this happens.

using UnityEngine;
using System.Collections;

public class pivot : MonoBehaviour {
	
	public float rot_amount = 100;
	
	public Transform target;
	
	
	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		  transform.RotateAround(target.position, Vector3.up, rot_amount * Time.deltaTime);	
	}
}

RotateAround is working fine, this will rotate your object around the player and radius will be distance between object and player. You told that you are moving the player if you will move the player then absolutely distance between player and objec will be changed that’s why your orbit radius will also be changed accordingly.

The typical solution is to make the rotating object a child of the target. Then the rotating object will follow the target when it moves. There is one side effect of this solution. The rotating object would also be effected by any rotation of the target.

Another solution is to have the rotating object follow the object without being a child. Example:

using UnityEngine;
using System.Collections;

public class Pivot : MonoBehaviour {
	
	public float rot_amount = 100;
	public Transform target;

	private float dist;

	void Start() {
		dist = (target.position - transform.position).magnitude;
	}

	void Update () {
		transform.position = (transform.position - target.position).normalized * dist + target.position;
		transform.RotateAround(target.position, Vector3.up, rot_amount * Time.deltaTime);   
	}
}