I am trying to update the score from shooting an enemy in my gun script and sending it to my playerStats script, but it is only updating in the gun script.
Relevant code:
public class PlayerStats : MonoBehaviour
public float currScore;
void Start()
{
currentHealth = maxHealth;
currScore = 0;
}
public void AddScore(float amount)
{
currScore += amount;
}
public class Gun : PlayerStats
private float amount = 50;
Enemy enemy = hit.transform.GetComponent();
if (enemy != null)
{
enemy.TakeDamage(damage);
AddScore(amount);
}