Changing Weapon Damage

Im fairly new to unity and scripting so sorry if this is basic;
I want to be able to set different damage for different weapons.
Here is the script I attached to the weapon:

#pragma strict

var Effect : Transform;
var TheDamage = 100;

function Update () {

    var hit : RaycastHit;
    var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));
    
    if (Input.GetButtonDown("Fire1"))
    {
         if (Physics.Raycast (ray, hit, 100))
         {
         		hit.transform.SendMessage("ApplyDamage", TheDamage, SendMessageOptions.DontRequireReceiver);
         }
    }

}

and here is the script I applied to the enemy;

#pragma strict

var Health = 100;

function ApplyDamage (TheDamage : int){

var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width*0.5, Screen.height*0.5, 0));

{
	
	{
	if (Physics.Raycast (ray, hit, 100));
	
		Health -= TheDamage;
	
		if(Health <= 0)
		{
		Dead();
		}
	}
}
}

function Dead()
{
	Destroy (gameObject);
}

Do I need to change anything in these scripts or make a new one?

Thanks

Attach this script to any weapon you create:

using UnityEngine;
using System.Collections;

public class MyWeapon : MonoBehaviour {
    public float Damage = 100f;
    
    public void Update() {
        if (Input.GetButtonDown("Fire1")) {
            Shoot();
        }
    }
    
    public void Shoot() {
        //create the ray's variable inside this if statement, so you avoid
        //creating it when it's not going to be used
        RaycastHit hit;
        //using ViewportPointToRay() since it does the same job for you 
        //as ScreenPointToRay(), but with less maths (not a bit 
        //performance improvement, but just doing it so you know another way)
        Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f,0.5f,0f));
        if (Physics.Raycast (ray, out hit, 100f)) {
            //send the message the same way you were before
            hit.transform.SendMessage("ApplyDamage",Damage,SendMessageOptions.DontRequireReceiver);
        }
    }
    
}

Attach this script to your enemy (ensuring your enemy has some kind of collider attached to it with isTrigger unticked, so your Physics.Raycast() will be able to hit it):

using UnityEngine;
using System.Collections;

public class MyEnemy : MonoBehaviour {
    
    public float health = 100f;
    
    public void ApplyDamage(float DamageAmount) {
        //No need to raycast again in this method, since you 
        //already know this has been hit / damaged by whatever!
        //Also, by taking the raycast out of this method, you 
        //can use this method to apply damage from any source
        //to your enemy... eg, environmental hazards you 
        //script, explosions you script, etc.
        
        health -= DamageAmount;
        
        if (health<0f) {
            Die();
        }
    }
    
    public void Die() {
        Destroy(gameObject);
    }
}

From here, you can just create several weapons, attach the MyWeapon script to them, set their damage in the Inspector tab, and then save them as a Prefab. After that, changing weapon will be as simple as making a script for your player similar to this (noting you’d probably want to swap SetActive() with a method for your MyWeapon that makes the weapon swap in or out smoothly instead of just disappearing):

using UnityEngine;
using System.Collections;

public class MyPlayer : MonoBehaviour {
    public MyWeapon[] weapons;
    public int currWeapon = -1;
    
    public void Update() {
        //simple implementation of weapon swapping with the scroll wheel
        if (weapons.Length>1) { //only swap weapons if the list of weapons has more than 1 weapon in it, otherwise swapping will have no effect
            float scrollAmount = Input.GetAxis("Mouse ScrollWheel");
            //if the player scrolls up...
            if (scrollAmount>0f) {
                weapons[currWeapon].SetActive(false); //deactivate the current weapon
                //get the index of the next weapon
                currWeapon++;
                if (currWeapon>weapons.Length) {
                    currWeapon = 0;
                }
                weapons[currWeapon].SetActive(true); //activate the new current weapon
            }
            //if the player scrolls down...
            else if (scrollAmount<0f) {
                weapons[currWeapon].SetActive(false); //deactivate the current weapon
                //get the index of the next weapon
                currWeapon--;
                if (currWeapon<0) {
                    currWeapon = weapons.Length-1;
                }
                weapons[currWeapon].SetActive(true); //activate the new current weapon
            }
        }
    }
}