Scoring (i'm stuck)

hey guys i have a scoring system that i would like to get working. whats supose to happen when the bubble is destroyed bye a raycast it has to add up into my point system script i have if you guys can help me out i would really appreciate it!

#pragma strict

static var score : int = 0;


 
    function OnCollisionEnter ( collision : Collision)
    {
        if (collision.gameObject.tag == "bubble"){
        score += 1;
        
     
        
        }
       
    
	}


function OnGUI()
{
 	GUI.Label( Rect(Screen.width - 90, Screen.height -35, 100, 20), "Points: " + (score));
	
}

function Update () {
  
    }

no OnMouseButtonDown its a raycast here is the script that is place on my camera

function Update(){
    for (var touch : Touch in Input.touches) 
    {
        if (touch.phase == TouchPhase.Began) 
        {
            
            var ray = camera.ScreenPointToRay(touch.position);
            var hit : RaycastHit;
            if (Physics.Raycast (ray, hit, 400))
            {
                
                hit.transform.SendMessage("DecHealth", 1, SendMessageOptions.DontRequireReceiver);
            }
        }
    }
}

script place on my bubbles for health and how many taps to kill.

unction Start()
{
    if (bubbleEasy == true){ 
        Health = 1;
    }
    else if (bubbleMed == true){
        Health = 2;
    }     
    else if (bubbleHard == true){
        Health = 3;
    }
}
 
function DecHealth(howMany: int)
{
    Health -= 1;
    if (Health <= 0){ 
        Destroy(gameObject);
    }
}
 
function OnDestroy (){
    tapCount += 1;
}

any help would be great thanks guys

if you already have the buble destruction set up you can put

function OnDestroy()
{
    ContainingScript.score += 1;
}

in a script attatched to each bubble

You’re using OnCollisionEnter(), but you have nothing colliding, that’s the problem, just

increase the score, when you get the touch:

function Update(){
for (var touch : Touch in Input.touches)
{
if (touch.phase == TouchPhase.Began)
{

        var ray = camera.ScreenPointToRay(touch.position);
        var hit : RaycastHit;
        if (Physics.Raycast (ray, hit, 400))
        {

<SCRIPT WHERE THIS VAR IS (IF IT IS OUTSIDE THIS)>.score += 1;
            hit.transform.SendMessage("DecHealth", 1, SendMessageOptions.DontRequireReceiver);
        }
    }
}

}

Or put it inside the DecHealth():

function DecHealth(howMany: int)
{
    <SCRIPT WHERE THIS VAR IS (IF IT IS OUTSIDE THIS)>.score += 1;
    Health -= 1;
    if (Health <= 0){ 
        Destroy(gameObject);
    }
}