I am trying to reduce the number of enemys from another class when a spider is hit.

Here is my bullet class;

void OnTriggerEnter (Collider hit){

	if(hit.gameObject.tag == "Spider1"){
		player = GameObject.FindGameObjectWithTag("Player");
		int EL = player.GetComponent(enemysLeft);
		EL = EL-1; 
		Destroy(hit.gameObject);
		Destroy(gameObject);
		Instantiate(spawnSpider1);
		if (EL == 0)
			Application.Quit();

	}

Heres the enemy class

public int enemysLeft = 10;
	
	
	void Start () {
		
		enemysLeft = 10;
	} 

These are the errors i am receiving

error CS1503: Argument #1' cannot convert int’ expression to type System.Type' error CS1502: The best overloaded method match for UnityEngine.GameObject.GetComponent(System.Type)’ has some invalid arguments

GetComponent is looking for either the name of the component you are looking for (I.E. the string name of the script attached to the object, or some DataType of the object, transforms, scales, etc.). enemysLeft is a variable declared within a script, and not the script itself.

A good way to accomplish your task here would be to make enemysLeft a static member of the Enemy class. In this way you can access it without having to instantiate an Enemy, and it would be easily accessible throughout your game.

In your Enemy class:

public class Enemy
{
    //Static variables are shared across all instances
    //of a class.
    public static int enemysLeft = 10;
    
    public Enemy()
    {
        
    }
}

When you want to decrease the enemysLeft:

if(hit.gameObject.tag == "Spider1"){
       player = GameObject.FindGameObjectWithTag("Player");
       Enemy.enemysLeft -= 1; //use the static variable you created
       Destroy(hit.gameObject);
       Destroy(gameObject);
       Instantiate(spawnSpider1);
       if (EL == 0)
         Application.Quit();
 
    }

You need a variable of the script type

NameOfScript varibleForNameOfScript;

You need to specify the name of the script in

variableForNameOfScript = GetCompnent<NameOfScript>();

then use

int EL = variableForNameOfScrip.enemysLeft;
EL-=1;

So assume you script is name EnemyClass.

I have not tested this!

using UnityEngine; 
using System.Collections;

public class Bullet : MonoBehaviour { 

GameObject player;
EnemyClass enemyClass;
public int EL;

	void Start(){
		player = GameObject.FindGameObjectWithTag("Player");
		enemyClass = player.GetComponent<EnemyClass>();	
	}


	void OnTriggerEnter(Collider hit){

		if(hit.gameObject.tag == "Spider1"){
			EL = enemyClass.enemysLeft;
			EL-=1;

			Destroy(hit.gameObject);
			Destroy(gameObject);

			Instantiate(spawnSpider1);

			if(EL == 0){
				Application.Quit();
			}
		}
	}
}