Make Raycast keep shooting

My raycast script only lets my raycast shot once, but i want it to shoot like a machine gun not a single fire weapon, is there any part i can add to my script to make the raycast keep shooting while im holding down the shoot button? Any help at all would be great.
Heres my script

#pragma strict

var Range : float = 1000;
var Force : float = 1000;

var hitMark : GameObject;

var texta : GUITexture;

		
		
		
		var hit : RaycastHit;
				
		var direction : Vector3  = transform.TransformDirection(Vector3.forward);
         
		Debug.DrawRay(transform.position , direction * Range , Color.blue);
				
			if(Input.GetMouseButtonDown(0)){
			
			bullets--;
				
}

1 Answer

1

GetMouseButtonDown() only returns true when the button is first pressed. GetMouseButton() will return true as long as the button is being pressed. Then in your if statement, you can include some timing code to make the raycast shoot at a certain frequency