How to make a Kill Counter

Hey im using a GUI to display how many turrets the player kills but for some reason it wont count up heres the code for the gui:`function Update () { var killCount: int; var globalCounter : GameObject = GameObject.FindWithTag("GlobalVars");

killCount = 0;

if (gameObject.Find("SmallTurret").hit) { 
    globalCounter.killCount += 1;
    print("kill count is now: "+globalCounter.killCount); 


and the code i put with the turret:

 var explosion : Transform; 

private static var numKills : int; var killsDisplay : GUIText; if(gameObject.tag == "wormProjectile") { numKills++ ;

killsDisplay.text = "Kills: "+numKills; }

function OnTriggerEnter( hit : Collider )

    if(hit.gameObject.tag == "wormProjectile")

    var exp = Instantiate(explosion, gameObject.transform.position, Quaternion .identity);


Ooooooooook, please, no one write him a whole script...

Now, for the actual scripting for the kill count, you'll need a health system, or if it's one shot kill, you'll need to have to look at the collider API

Now, when it hits, you'll need to check out the GUI.

Now, this should cover most of it... Their is also a Destroy() function to make the turret disapear and you can see the instantiate to make a "dead" turrent model appear in its place.

Now, will help with scripting, and now, my fine feathered friend, you're armed to code your own project.

Good luck, and be safe, and PLEASE comment your code if you want people to help you.