prefab localscale

I have a pickup in my game that transforms the scale of my player object when it collides with it. the problem I am having is that when ever i make duplicates/childs of the parent object (pickup) the local scale transform does not replicate over onto the other pickups there for when the player collides with them it gets destroyed but the player does not get scaled again.

public class PickupCollsion : MonoBehaviour {

   void OnTriggerEnter( Collider other)
    {
        if(other.tag == "Player") // if the tag of the gameobject is player the pickup gets removed
        {
            Vector3 newScale = transform.localScale; // sets newscale for the player
            newScale *= 1.2f; //new scale value for the player
            other.transform.localScale = new Vector3(1.2f, 1.2f, 1.2f); // the players x, y, z values will gbe increased by these values
            Destroy(gameObject); //Pickup gameobject gets destroyed on collision

        }
    }

You’ve created the newScale Vector3 but you’re not using it to scale the player. “transform.localScale” is getting the scale of your pickup object not the player. Use “other.transform.localScale” to get the players scale and then set the scale of the player to newScale and your player object will scale up each time it collides with another pickup object. Also you should use other.CompareTag instead of other.tag for optimization purposes.

if(other.CompareTag ("Player")) // if the tag of the gameobject is player the pickup gets removed
{
    Vector3 newScale = other.transform.localScale; // sets newscale for the player
    newScale *= 1.2f; //new scale value for the player
    other.transform.localScale = newScale; // the players x, y, z values will gbe increased by these values
    Destroy(gameObject); //Pickup gameobject gets destroyed on collision

}

THANK YOU. that has sorted it out.