How to create a Expierence system for every kill

THE LEVELING UP SCRIPT HAS BEEN RECIEVED THANKS TO JOSHUA NO NEED FOR THE LEVELING UP SCRIPT NOW I JUST NEED A SCRIPT FOR RECIEVING THE EXP POINTS THANK YOU.

Well i want to make a experience bar system in unity3d. I went through and found some answers but they didnt help me much. So want to make it so that Everytime you kill someone you get 5 experience out of 50 at level 1. Then when you level up your going to need more then 50 experience. You will need 100 at level 2. Then level 3 you need 100. So you need to just double everytime you level up. and one you see your profile it shows a special texture like for a level 1 there is a Red dot and level 2 there are 2 red dots and at level 3 there are 3 red dots then level 4 it changes from dots to stars and so on. Oh and if you complete challanges your get like a extra 50 experience points and so on. So is there any way to do this. Just give me a full script and under it tell me what to do to use and if you want explain on how they work.

Well i have tried and here is my code for holding expierence points. Change it as much as you want.

var exp = 1;
var expneeded : int = 50;
var level : int = 1;
var level1symbol : GUITexture;
var level2symbol : GUITexture;
var level3symbol : GUITexture;
var level4symbol : GUITexture;
var level5symbol : GUITexture;
var level6symbol : GUITexture;
var level7symbol : GUITexture;
var level8symbol : GUITexture;
var level9symbol : GUITexture;
var level10symbol : GUITexture;

function Update ()
{
    if ( level = 1)
    {
        var expneeded = 50;
        level1symbol.mesh = true;
        level2symbol.mesh = false;
        level3symbol.mesh = false;
        level4symbol.mesh = false;
        level5symbol.mesh = false;
        level6symbol.mesh = false;
        level6symbol.mesh = false;
        level7symbol.mesh = false;
        level8symbol.mesh = false;
        level9symbol.mesh = false;
        level10symbol.mesh = false;
    }
    else ( level = 2 )
    {
        level1symbol.mesh = false;
        level2symbol.mesh = true;
        level3symbol.mesh = false;
        level4symbol.mesh = false;
        level5symbol.mesh = false;
        level6symbol.mesh = false;
        level6symbol.mesh = false;
        level7symbol.mesh = false;
        level8symbol.mesh = false;
        level9symbol.mesh = false;
        level10symbol.mesh = false;
    }
}

Well is keeps going with the else if ( level = . )

Thank you.

This should get you started

var exp = 0;
var expNeeded = 50;
var level = 1;
var currentLevelSymbol : Texture;
var level1symbol : Texture;
var level2symbol : Texture;
var level3symbol : Texture;
var level4symbol : Texture;
var level5symbol : Texture;

function Start(){
    expNeeded = 50;
}

function Update (){
    AddjustCurrentExp(0);

    if(exp >= expNeeded){
        exp = 0;
        level += 1;
    }

    if(level >= 1){
        currentLevelSymbol = level1symbol;
        expNeeded = 50;
    }
    if(level == 2){
        currentLevelSymbol = level2symbol;
        expNeeded *= 2;
    }
    if(level == 3){
        currentLevelSymbol = level3symbol;
        expNeeded *= 2;
    }
    if(level == 4){
        currentLevelSymbol = level4symbol;
        expNeeded *= 2;
    }
    if(level == 5){
        currentLevelSymbol = level5symbol;
        expNeeded *= 2;
    }
}

function AddjustCurrentExp(adj) {
    exp += adj;
}

function OnGUI(){
    GUI.DrawTexture(Rect(10,10,30,30), currentLevelSymbol, ScaleMode.ScaleToFit, true);
}

What about to program they enemy so it gives you xp too.

i was thinking about using something with the Tags set to Enemies?