Javascript Snakegame Error Cannot convert ....Gameobject to .....Transform

I am trying to create a snake game following couple of tutorials, now i am having an error and can not find a way to solve it… maybe someone here could help me.

function addPiece()
	var newPiece : GameObject = Instantiate(piece, transform.position - (rigidbody.velocity*100), Quaternion.identity); = "Piece";
	(newPiece.GetComponent(SmoothFollow)as SmoothFollow).target = lastPiece;
	lastpiece = piece;

i get this error
Assets/snakeMovement.js(86,71): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘UnityEngine.Transform’.

I am guessing the SmoothFollow target is a transform but last piece is a gamobject. Next time add a comment on the code so we can see what line is failing :P.

If thats the case try:

(newPiece.GetComponent(SmoothFollow)as SmoothFollow).target = lastPiece.transform;