ontriggerenter destroy -- object stays on screen

I am new, and i am making a pac man clone. i want pac man to hit a while pellet (box collider with trigger) and on impact, the pellet disappears.

I have tried
// Destroy everything that enters the trigger
function OnTriggerEnter (other : Collider) {
Destroy(other.gameObject);
}

pacman can run through objects that have this trigger, but those objects remain in view.
help please?

2 Answers

2

attach this onto the Player

function OnTriggerEnter(x : Collider){
    if(c.gameObject.tag == "Pellet"){
        Destroy(x.gameObject);
    }
}

getting an “unknown identifier” error using js

and
identifier expected
a namespace can only contain types and namespace definitions using C#