Accesing script from newly instantiated game object

Hi guys.So im trying to acces a script form a newly created object.I am creating the player Object at startup and i want enemy object to acces the script from the player object.
I was not quite sure how to do this so in the inspector i just put the player prefab.
Doing this gave me no errors but the character is not reciving Exp either.

This is the code i have on the enemy script:
WarriorObj here is the player prefab but it is not working as i want it too:

 PlayerStats StatsScript = WarriorObj.GetComponent<PlayerStats>();
 StatsScript.Exp += 20;

Try creating a public function in PlayerStats that will increment it’s Exp. For example:

public AddExp(int expAmount){
    Exp += expAmount;
}

Edit: Forgot to add that you should then call this in the same way you did before, but instead of:

StatsScript.Exp += 15;

Use:

StatsScript.AddExp(15);