Changing a variable from another script

Hi, this surely was answered many times, but i’m pretty new in this and I don’t understand many explanations in here.

Actually its pretty simple, I have a player script and an enemy script. I want to change enemy HP from player script.

To accès and modify variable of other script you need to get reference of that script in your current script. In your example you need to do this.

// GET reference publicly dragging enemy in your script’s inspector
public Enemy EnemyReference;

EnemyReference.HP = 5;