first person controller carry flag

I ve a terrain, in terrain i ve a first person controller and also a flag on a hill.
When FPC triggers the flag, FPC grabs the flag and carries it.
The problem is, when FPC makes a rotation, flag is staying behind the FPC.
here is my script;

#pragma strict

public var grab = false;
public var firstPC : GameObject;
var flagPos : Vector3;
var flag: Transform;

function Update () {
	if(grab== true)
	{
		flagPos= Vector3(firstPC.transform.position.x, firstPC.transform.position.y, firstPC.transform.position.z);
		flag.transform.position = Vector3(flagPos.x,flagPos.y,flagPos.z);
	}
}

function OnTriggerEnter (other : Collider) {
	grab= true;
}

In addition to putting the flag at the position, you also want to parent the flag. Insert below line 12:

  flat.transform.parent = transform;

I’m assuming here that this script is on the object that is going to be carrying the flag. If not, you need to use that transform. In addition, I don’t see a definition for ‘bayrakPos’ in the above script.