I cant damage my Enemy

I started making my second enemy, Its a ghost that comes flying to u when you walk to it.
I got it working and all but I cant damage it and it keeps giving my this error:
NullReferenceException: Object reference not set to an instance of an object PlayerAttack.Update () (at Assets/Script/PlayerAttack.cs:86)
I dont get it because I can damage my other enemy.


my Attack script

my Ghost enemy script:

@Yased I believe that the issue here is that the list of objects you’re going through on line 86 “enemiesToDamage”
has a null reference maybe a result of an already destroyed enemy? i can see in your script that destroying an enemy does not remove it from the list of enemies to damage which can leave an address in your list without a reference to it.
Feel free to check and let me know if it resolved your issue.