# Projectiles (131820)

**URL:** <https://discussions.unity.com/t/projectiles-131820/131820>\
**Category:** Questions & Answers\
**Created:** [February 27, 2015, 9:20pm UTC](https://discussions.unity.com/t/projectiles-131820/131820 "2015-02-27T21:20:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FKKrjakonzo](https://avatars.discourse-cdn.com/v4/letter/f/58f4c7/32.png) [@FKKrjakonzo](https://discussions.unity.com/u/FKKrjakonzo)\
**Post date:** [February 27, 2015, 9:20pm UTC](https://discussions.unity.com/t/projectiles-131820/131820/1 "2015-02-27T21:20:31Z")

</div>

Could someone help me with this script:

```
var projectile : Rigidbody;
var speed = 20;

function Update () {

if ( Input.Input.GetMouseButtonUp(0)) {

clone = Instantiate(projectile, transform.position, transform.rotation);
clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));

Destroy (clone.gameObject, 3);
}} 

```

Problem here it is that this script create a lot of this objects but i want only one in 2 seconds.  
Sorry for bad english

---

<div class="post-metadata">

**Author:** ![maccabbe](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@maccabbe](https://discussions.unity.com/u/maccabbe)\
**Post date:** [February 27, 2015, 9:46pm UTC](https://discussions.unity.com/t/projectiles-131820/131820/2 "2015-02-27T21:46:11Z")

</div>

If you want to limit projectiles to once every 2 seconds use the following script

```
var time=2.0;
function Update () { 
    time = time + Time.deltaTime;
    if (Input.GetMouseButtonUp(0)&&time>=2.0) {
        time=0.0;
        Debug.Log("Click");
    }
}

```

However it seems that you are accidentally making multiple projectiles per click.

```
function Update () { 
    if (Input.GetMouseButtonUp(0)) {
        Debug.Log("Click");
    }
}

```

Only prints once per click. A possible reason for multiple projectiles being created per click is that Update is being called from another script.
