Hii, idk what’s wrong with my code
and this is the script of Enemyhealth
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemyhealth : MonoBehaviour
{
[SerializeField]protected int maxhp = 10;
private int currenthp;
void Start() => currenthp = maxhp;
public void takeDamage(int damage)
{
currenthp -= damage;
if (currenthp <= 0) {
Die();
}
}
protected virtual void Die()
{
Destroy(gameObject);
}
}
