A problem that is stopping me in my track,Parsing error!

var bounce : bool = false;
var bounceAmount : float = 10;
var Player : Transform;

	function OnCollisionEnter (other : Collision) 
{
	if(other.gameObject.tag == "Player") 
	{
		bounce = true;
	}
}

}

function Update () 
{
	if(bounce) 
	{
		Player.rigidbody.velocity.y = 0; Player.rigidbody.AddForce(0,bounceAmount,0,ForceMode.Impulse);
		bounce = false;
	}
}

}

Here is my script and I’m having a parsing error(CS8025) which i can’t seem to find a solution for no matter how hard i’ve trying. :frowning:
Please assist me with this anyone. I would greatly appreciate the assistance.

This happens because of the extra “}” at the very bottom of your script, which marks the end of a block which never began. So the compiler meets that brace, there, and goes all “Wait, what? What is it that’s supposed to end here? Screw you, I can’t parse that. Have a CS8025”. :slight_smile:

Edit:

I’m a C# developer, so I claim no experience with UnityScript’s syntax, but I actually also think it’ll want you to put “Boolean” instead of “bool” there, at the top. In any case, I made a couple of modifications, and this compiles on my machine:

import System;

var bounce : Boolean = false;
var bounceAmount : float = 10;
var Player : Transform;
 
function OnCollisionEnter (other : Collision) 
    {
        if(other.gameObject.tag == "Player") 
        {
            bounce = true;
        }
    }

function Update () 
{
    if(bounce) 
    {
        Player.rigidbody.velocity.y = 0; Player.rigidbody.AddForce(0,bounceAmount,0,ForceMode.Impulse);
        bounce = false;
    }
}

There is also problem with one more curly bracket.

import UnityEngine;
import System.Collections;

    var bounce : boolean = false;
    var bounceAmount : float = 10;
    var Player : Transform;

function OnCollisionEnter (other : Collision) 
{
    if(other.gameObject.tag == "Player") 
    {
        bounce = true;
    }
}



function Update () 
{
    if(bounce) 
    {
        Player.rigidbody.velocity.y = 0; 
        Player.rigidbody.AddForce(0,bounceAmount,0,ForceMode.Impulse);
        bounce = false;
    }
}