Anyway to make an object constantly float in front of the player?

As the title says, I’m trying to get a cube to float in front of the player (cube is a placeholder until i can get the scripts working properly)

However, what keeps happening is that the cube flys into the character and then circles around the central point of the player - is there a way to get it to go within a certain radius of the player and then just float around in front of them?

Heres what I’m using at the moment:

var target : Transform; 
var moveSpeed = 20; 
var rotationSpeed = 5; 
var myTransform : Transform;

function Awake() { myTransform = transform; }
function Start() {
target = GameObject.FindWithTag("Player").transform; 
}

function Update () {

 myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
 Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime); 
 myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

Any advice would be greatly appreciated as my programming skills aren’t exactly top notch!

thanks in advance, Cobaas

Instead of setting the player as the target you could child an empty GameObject to it, move it where you want the cube to float and use that as a target.