BCE0043 Error when converting Unity code to Unity iPhone

I’m totally new to Unity and coding and am trying to convert some code for Unity into an iPhone game I’m working on, but have one last error that I can’t seem to resolve. It’s telling me I have error BCE0043: Unexpected token: … as far as I can tell on the line and character count it doesn’t like my AddComponent code. My original Unity code was

function InstantiateBullet()
{
	if(Time.time > nextFire)
	{
		nextFire = Time.time + 1.4;
		attackEvent.time = tempAttackTime;
		animation["attack"].weight = .5;
		clone = Instantiate(fireBall, hand.position, hand.rotation);
		Physics.IgnoreCollision(clone.collider, collider);
		clone.rigidbody.velocity = transform.TransformDirection(Vector3.forward * 20);
		var bulletScript = clone.gameObject.AddComponent("BulletScript"); 
		bulletScript.playerShooting = this.gameObject;
	}
	
}

which I then tried to change to

function InstantiateBullet()
{
	if(Time.time > nextFire)
	{
		nextFire = Time.time + 1.4;
		attackEvent.time = tempAttackTime;
		animation["attack"].weight = .5;
		clone = Instantiate(fireBall, hand.position, hand.rotation);
		Physics.IgnoreCollision(clone.collider, collider);
		clone.rigidbody.velocity = transform.TransformDirection(Vector3.forward * 20);
    	var bulletScript = clone.gameObject.(AddComponent("BulletScript") as BulletScript);
		bulletScript.playerShooting = this.gameObject;
	}
	
}

Any help would be greatly appreciated. Thanks.

In your second example you have a paren immediately after the period following “gameObject”:

gameObject.(AddComponent...etc

That would generate the Unexpected token…but I didn’t see that in your first example.

Do you mean the “BulletScript” part right after AddComponent? I have that immediately following AddComponent in the first script as well.

can anyone help?

It’s like BoredKoi said, there is an unexpected bracket “(” before AddComponent in the second script. Remove it and it should be fine.

I thought I needed that bracket since from what I saw you were supposed to have a bracket around the whole statement so I have that then the end bracket after “as …”, that part just happened to go onto the next line, but I’ll try just taking both of those brackets out.