How would I make an object move forward based on the camera attached to it?

Hello, I’m a student working on my Game Production 1 final. I’m trying to make a character, move forward in relative to the camera parented to it. I tried using “var fowardDirection = Camera.main.transform.TransformDirection(Vector3.forward)” in order to link the camera and the character but the result a warning: Unused Local Variable, and the mechanic not working in the Unity Editor. This is the code I’m currently using.

function Awake()
{
	controller = GetComponent(CharacterController);
}

function Update () 
{
	if(controller.isGrounded)
	{
		if(charge <= maxCharge && Input.GetButton("Jump"))
		{
			charge++;
			print(charge);
		}
		 else if(Input.GetButtonUp)
		 {
		 	charge = 0;
		 }
		
		moveDirection = Vector3(0, 0,Input.GetAxis("Vertical"));
		//moveDirection.z = Input.GetAxis("Vertical");
		moveDirection = transform.TransformDirection(moveDirection);
		moveDirection *= moveSpeed;
		
		Jumping();
		RotateChar();
	}
	Burst();
	
	moveDirection.y -= gravity * Time.deltaTime;
	
	controller.Move(moveDirection);	
	visualSphere.transform.Rotate(Vector3(moveDirection.x, moveDirection.z, 0));
}

function Jumping()
{
	if (canJump != maxJumps)
	{
		if (charge >= maxCharge && Input.GetButtonUp("Jump"))
			{
				moveDirection.y = superJumpSpeed * Time.deltaTime;
				
			}
			else if (Input.GetButtonUp("Jump"))
			{
				moveDirection.y = jumpSpeed * Time.deltaTime;
			}
	}
}
public function RotateChar()
{
	transform.Rotate(0,Input.GetAxis("Horizontal") * rotateSpeed * Time.deltaTime,0);
}

function Burst()
{
var fowardDirection = Camera.main.transform.TransformDirection(Vector3.forward);

	if(Input.GetButton("Fire1"))
	{
		forwardDirection = force * Time.deltaTime;
	}

The problem is the burst function at the end. When you click and hold the “fire1” button, the character supposed to shoot forward. Am I perhaps missing something somewhere in the code, or perhaps am doing this the wrong way?

What about Camera.main.transform.forward?

In the future, please post the least amount of code as is possible. Sometimes it gets hard to read an entire page worth when you’re not sure what part is important to the question.

Thank you.