Hello guys, im just curious how can i make a simple shooting script for a gun, all i really need is to make it shoot a bullet with the force of 2000. Heres a script i have worked on but it doesnt work.
The script:
var bullet : Transform;
var Force = 2000;
function Update ()
{
if(Input.GetKeyUp(KeyCode.Mouse0))
{
var shot = Object.Instantiate(bullet, transform.position, transform.rotation, 0);
shot.rigidbody.AddForce(transform.forward * Force);
}
}