Shooting script?

Does anyone know a script where I can put it on my SCAR-H model in Unity and when I click it shoots a projectile out? Thanks using this for my game i’m making and i’m a noob at scripting. Will give credit to whoever shows me or writes the script!

something like

function LeftMouseClick():{

i’m a noob xD

You can make a cube GameObject (just for now until you make an actual bullet) and add a RigidBody to it and a Box collider, thus acting as the bullet. Then you make a script and do something like this in the class you make.

public Rigidbody bullet;

void Update()
{
if(Input.GetMouseButtonDown == true)
{
GameObject.Instantiate (bullet, transform.position, transform.rotation);
}
}

That should work… It’s been a while d:

If i were you, download bootcamp from the asset store and look trhough and use their scripts for shooting :confused: their really… well … awesome.

Thanks for the script it worked! Yes bootcamps scripts are great!