problem with destroying objects

Hello so im using the GameObject.FindGameObjectsWithTag and whenever i run the game it wont destroy my prefabs when i try to destroy them, And i even applied the tag on the gameobject whats going On?

function Erase() {

if (HitBlock())


Yeah, that’s not how you use Destroy. This will destroy the array returned by FindWithTag, not the actual objects contained inside it!

Also, you are using


there is no such member in transform. If you are trying to find only those gameObjects that are children of that transform, you need to check the individual members returned by the class function FindGameObjectsWithTag.

What you should be using instead is

for(var obj : GameObject in GameObject.FindGameObjectsWithTag("Block"))

Of course, this assumes that hit is a valid variable, and has a member called ‘transform’ that is a Transform. Make sure you’re doing all of that, too.