Problem with implenting a simple point system

Hi, I’m trying to make a simple point system for a game I’m working on, However, I can’t get it to work. What I basically need to do is send a notice of some sort to my point system when a point is destroyed. my points and point system are different game objects so I tried the following for my points:

var AdjustPoints =false;
function OnTriggerEnter (other : Collider)
			AdjustPoints =true;	

and this for my point system:

var points :int = 0;

function Update()
	var Points = GameObject.FindWithTag("Point");
	var Adjust = (Points.GetComponent(DestroyPointScript).AdjustPoints);
	if (Adjust = true)
			points + 1;

Two simple scripts that for as far as I can see should work, however it does not. I’ve tried a couple variations on this as well, however those only gave me more errors :expressionless:

This only gives me a couple small errors, which are the following:

Assets/Scripts/General/PointSystem.js(7,20): BCE0044: expecting ), found ‘=’.

Assets/Scripts/General/PointSystem.js(7,22): BCE0043: Unexpected token: true.

Assets/Scripts/General/PointSystem.js(9,35): BCE0044: expecting :, found ‘;’.

I can imagine these are easily fixed, however I can’t seem to find how exactly. I keep getting the famous “Accessing other GameObjects” page, however this doesn’t seem to solve my problem. Or I am somehow misreadiing something there… I could use some help fixing this:D

Anyway, Thanks in advance!

There are a couple of things you should keep in mind.

== (Equals equals) is the if-statements equals to. When you work with booleans you only have to do this:

if(Adjust) //If (Adjust == true)
if(!Adjust) //If (Adjust != true)

A single equals is for setting variables. Don't forget to type booleans also (all your variables should), var AdjustPoints : boolean = false;.

Isn't it better to run a function for adjusting points called from OnTriggerEnter?

function OnTriggerEnter () {

static function AdjustPoints () {
    points++; //And so on

If you don't need the Collider then remove it from OnTriggerEnter, it's unnecessary to set the variable `other` if you don't use it. Also never ever run a find-function from within Update(), use functions instead that only gets called when they're needed. Don't get components inside Update() either. Use Start(), Awake() or your own function to retrieve components from other objects,

private var dps : DestroyPointScript;
private var points : GameObject;
function Start () {
     points = GameObject.FindWithTag("Point");
     dps = points.GetComponent(DestroyPointScript);

To make things easier in the long run disable dynamic scripting by using #pragma strict on the top of your document(s).