how to instantiate objects for single time

how i am making a game where there is a ring which goes back and forth in the x direction and when i press a key i falls down now i want to instantiate another ring but it instantiates but clones the object 4 times i want it for one time

below is my code.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RingController : MonoBehaviour {
 Rigidbody rb;
	public GameObject ring;

	private float Ringtransition=0.0f;
	private float Ringspeed = 2.5f;
	private const float Boud_size = 6.5f;

	// Use this for initialization
	void Awake(){
		rb = GetComponent<Rigidbody> ();

	void Start () {
		InvokeRepeating ("MoveRing", 0.019f, 0.019f);


	void MoveRing(){
		Ringtransition += Time.deltaTime * Ringspeed;
		float Xposition = Mathf.Sin (Ringtransition) * Boud_size;
		rb.transform.localPosition= new Vector3 (Xposition,6,0);


	// Update is called once per frame
	void Update ()
		if (Input.anyKey) {
			CancelInvoke ("MoveRing");
			rb.useGravity = true;
			Instantiate (ring, -ring.transform.localPosition,Quaternion.identity);



Your instantiation will occur on every frame till any key is pressed down. Please try using Input.anyKeyDown, it is only called for the 1st frame when you press any key.

Thank you all guys but i still have the same problem.

@ShadyProductions stated my problem well but i don’t know how to solve it as he says when i press the key for 1 time it instantiates 1 ring and then 2 then 4,8 so on.