Healthpickup isn't working

I’ve written a script for restoring health and it works on the player in the prefab folder but not with the player in the gaming area

code as it is:

public PlayerHealth playerHealth;
public Slider healthSlider;
public int HealthUp = 10;

void OnTriggerEnter(Collider col) 
	if (col.tag == "Player")
		playerHealth.currentHealth += HealthUp; // x = pHc + 10 
		healthSlider.value += playerHealth.currentHealth; //x = hS + pHc  
			Debug.Log ("Stage 1; Health restored");
			Debug.Log ("stage 2: Health pick gone");

The references are all correct, the pickup disappears but no health restore. Any suggestions?

Have you dragged a prefab as reference for PlayerHealth and slider?

The dragged reference of playerHealth and healthSlider variable should be present in the game scene.

If your healthpickup is instantiated, add references to these variables after instantiation.