can anybody give me a script for a weapon of some sort
Here's a script for a weapon:
// Insantiate a rigidbody then set the velocity
var projectile : Rigidbody;
var speed = 50;
function Update () {
// Ctrl was pressed, launch a projectile
if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Rigidbody;
clone = Instantiate(projectile, transform.position, transform.rotation);
// Give the cloned object an initial velocity along the current
// object's Z axis
clone.velocity = transform.TransformDirection (Vector3.forward * speed);
}
}
Put it on your camera. Next, drag the object you wish to use for your bullet onto the empty slot in the inspector. Hope this helps!
Have a go at this: http://unity3d.com/support/resources/tutorials/fpstutorial
If you want to skip reading the tutorial, you can download the completed project files to see how it was made.