How do I have objects disappear several seconds after insantiating them and how do I stop the player shooting for several seconds?

So I’m really new to unity and I’m trying to make a script that lets the player throw a ball which will disappear a few seconds after its been thrown so the scene doesn’t get cluttered but I can’t get it to work. I also want the player to have to wait for a few seconds after throwing five balls. I know this code is a mess but I’ve done the best I can and I’m very new to unity. Any help at all will be appreciated a lot and if anybody wants to point out the bits of code that I’m not using correctly I’d be grateful for that too. Basically thanks in advance for anything.

using UnityEngine;
usingsing System.Collections;

public class Throw : MonoBehaviour {

	static public int BallsThrown = 0;
	static public float Ammo = 5;
	public float speed = 10.0f;
	public Rigidbody Ball;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		
		GameObject drop = GameObject.FindWithTag("BallThrow");
		
		if (Input.GetKeyDown (KeyCode.E))
		{
			Rigidbody newInstance = Instantiate (ball, drop.transform.position, transform.rotation) as Rigidbody;

			Vector3 fwd = transform.TransformDirection (Vector3.forward);
			newInstance.AddForce(fwd*speed, ForceMode.Impulse);

			
			Destroy (rigidbody, 2.0f);

			BallsThrown += 1;

			if (BallsThrown >= Ammo) {
                                yield return new WaitForSeconds(5);
				BallsThrown = 0;
				
			}
		}

	}
}

Change your Destroy command to this:

Destroy(newInstance.gameObject, 2.0f);

You might also want to set a float to Time.time + 5f the check if the current time is past that for your delay.

// at the top of the script
private float nextThrowTime = 0f;

// in your if
if (Input.GetKeyDown (KeyCode.E) && Time.time > nextThrowTime)
{
    nextThrowTime = Time.time = 5f;

I wouldn’t normally instantiate a rigidbody, I’d do a GameObject and add component for rigidbody but I think it should work looking at the documentation.

Let me know if you get errors as I didn’t test the code and, well, typing isn’t a special power for me!