# How to destroy the object?

In contact with an object on the y coordinate of the object is not destroyed.

``````void Update () {
Rings.transform.Translate (new Vector3 (0f, -1f, 0f) * speed * Time.deltaTime);
if (Rings.transform.position == new Vector3 (transform.position.x, 0f, transform.position.z)) {
Destroy (Rings);
}
}
``````

Rings.transform.Translate (new Vector3 (0f, -1f, 0f) * speed * Time.deltaTime);
if (Rings.transform.position == new Vector3 (transform.position.x, 0f, transform.position.z))

You move the object down with a value that depends on deltaTime (framerate) and you expect its position to hit exactly (y == 0) at some point. This is very unlikely to happen ever. Depending on how you set and change the position of these objects, the same problem applies to x and z coordinates.

If you only move the object down and if the x and z coordinates don’t matter or change, your condition should be something like

``````void Update() {
if (Rings != null) {
Rings.transform.Translate(new Vector3(0f, -1f, 0f) * speed * Time.deltaTime);
if (Rings.transform.position.y < 0f) {
Destroy(Rings);
}
}
}
``````

If x and z matter, check that they are “close enough” to wanted values

``````void Update() {
if (Rings != null) {
Rings.transform.Translate(new Vector3(0f, -1f, 0f) * speed * Time.deltaTime);
if (Rings.transform.position.y < 0f &&
Mathf.Abs(Rings.transform.position.x - transform.position.x) < 0.1f &&
Mathf.Abs(Rings.transform.position.z - transform.position.z) < 0.1f) {
Destroy(Rings);
}
}
}
``````

Also you don’t show what is the type of `Rings`. If it’s a GameObject, everything is OK. If it’s something you attached to a GameObject (script), you should do `Destroy(Rings.gameObject)` instead.

Calling Destroy(Rings) is destroying the script Rings, if you want to destroy the game object attached to rings do Destroy(Rings.gameObject).