Getting XP when dies Help

Hello! :slight_smile: I have 2 Scripts. One for the “Stats” and one for “The Enemy”. I want so when an Enemy Dies
It Gives XP to the Player. How can i do that? Any Ideas? :slight_smile:

SCRIPT:

using UnityEngine;
using System.Collections;

public class EnemyHealth : MonoBehaviour {
public int maxHealth;
public int curHealth;
public int GiveXP;
public GameObject destroy;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	AddjustCurrentHealth(0);
}

public void AddjustCurrentHealth(int adj) {
	curHealth += adj;
	
	if(curHealth <= 0)
		Die();
	
	if(curHealth > maxHealth)
		curHealth = maxHealth;
	
	if(maxHealth < 1)
		maxHealth = 1;
	
}

public void Die () {
	curHealth = 0;
	Destroy(destroy);
}

}

I Tried This way:

using UnityEngine;
using System.Collections;

public class EnemyHealth : MonoBehaviour {
public int maxHealth;
public int curHealth;
public int giveXP;
public GameObject destroy;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
	AddjustCurrentHealth(0);
}

public void AddjustCurrentHealth(int adj) {
	curHealth += adj;
	
	if(curHealth <= 0)
		Die();
	
	if(curHealth > maxHealth)
		curHealth = maxHealth;
	
	if(maxHealth < 1)
		maxHealth = 1;
	
}

public void Die () {
	curHealth = 0;
	Destroy(destroy);
	Stats st = (Stats)GetComponent("Stats");
	st.XP += giveXP;
}

}

Any Ideas on this Problem?