OnTriggerEnter problem

So I am trying to make a 2d game and I came up with a problem: I was trying to create a script that destroys the main character when he and the enemy collide. The enemy already has a script that makes him run from left to righ and right to left in a certain spot. When I simple run into the enemy it works fine, but when my player stays still in a spot and the enemy runs into the player, the enemy just goes through the player and continues to walk back and forth.

Here is the script:

#pragma strict

var Limite : GameObject;
var Player : GameObject;
var spawnPoint : Transform;
var Tag = "";

function OnTriggerEnter (other : Collider) 
{
	if (other.CompareTag (Tag)) 
	{
			Limite.audio.Play();
			Destroy (other.gameObject);
			var P : GameObject = Instantiate(Player, spawnPoint.position, Quaternion.identity);
		
	}
}

Also: I didn’t get any errors.

that’s a rather odd way of using tags… I’d suggest you look at the scripting reference for them: Unity - Manual: Tags

which gameobject is that code attached to? the enemy?

Yes i have attached the script to the enemy.

does the player have an “OnTriggerEnter” function script on it too?

No. Should I attach one similar to the player?

i only know c# so bear with me.

i think you need to change

 if (other.CompareTag (Tag))

to:

if(other.Tag == "Tag")

or whatever the tag is for your player

Actually for strings you should use if(other.Tag.Equals("Tag"));

I’ve been trying all your sugestions and it’s still the same. Also i’ve noticed that when i die 1 time only one player is instantiated, but if i keep dying the game starts instantiating more than one player at the same time.