I am doing a 2d game and my player collides with 2 different objects. One it's for gaining health and the other one it's for damage it. So I have two tags : PowerUp( and this one works) and Hurt( I get in the console a message like this and I don't understand why : Registered a collision but with wrong tag: Hurt ) This is the script that I used, what I should change at it for this action of DAMAGE to take place ( and I tried on collision entered too)

```css
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class PowerUpDetector : MonoBehaviourPun
{
    // reference this via the Inspector
    [SerializeField] private Character healthbar;
    [SerializeField] private Character health;

    private void Awake()
    {
        if (!healthbar) healthbar = GetComponent<Character>();

    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        // or whatever tag your powerups have
        if (!other.CompareTag("PowerUp"))
        {
            Debug.LogWarning($"Registered a collision but with wrong tag: {other.tag}", this);
            return;
        }

        var powerup = other.GetComponent<PowerUp>();
        if (!powerup)
        {
            Debug.LogError($"Object {other.name} is tagged PowerUp but has no PowerUp component attached", this);
            return;
        }

        Debug.Log("Found powerup, pick it up!", this);
        powerup.Pickup(healthbar);

        if (!other.CompareTag("Hurt"))
        {
            if (photonView.IsMine)
            {
                photonView.RPC("Damage", RpcTarget.All);

            }

        }

    }
    [PunRPC]
    void Damage()
    {
        health.Health -= 20;
    }

}
```

Option 2 same error [enter image description here](https://i.stack.imgur.com/IZZN2.png)

```css
private void OnCollisionEntered2D(Collision2D col)
    {
        if( col.gameObject.CompareTag ("Hurt"))
        {
            if (photonView.IsMine)
            {
                photonView.RPC("Damage", RpcTarget.All);
            }
        }
    }
    [PunRPC]
    void Damage()
    {
        health -= 20;
    }
```

My players script with the healthbar 

```css
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;
using Photon.Pun;
using Photon.Realtime;
using Photon;
using UnityEngine.UI;

public class Character : MonoBehaviourPun,IPunObservable
{

    Rigidbody2D rb;
    float dirX;

    [SerializeField]
    float moveSpeed = 5f, jumpForce = 400f, bulletSpeed = 500f;

    [SerializeField] private float health = 100;
    [SerializeField] private Slider slider;
    [SerializeField] private Gradient gradient;
    [SerializeField] private Image fill;

    Vector3 localScale;

    public Transform barrel;
    public Rigidbody2D bullet;

    // Use this for initialization
    void Start()
    {
        localScale = transform.localScale;
        rb = GetComponent<Rigidbody2D>();
        if (photonView.IsMine)
        {

        }
        else
        {

        }
    }
    public float Health
    {
        get { return health; }
        set
        {
            health = value;
            slider.value = health;
            fill.color = gradient.Evaluate(slider.normalizedValue);
        }
    }

  /*  private void OnCollisionEntered2D(Collision2D col)
    {
        if( col.gameObject.CompareTag ("Hurt"))
        {
            if (photonView.IsMine)
            {
                photonView.RPC("Damage", RpcTarget.All);
            }
        }
    }
    [PunRPC]
    void Damage()
    {
        health -= 20;
    }*/
    // Update is called once per frame
    void Update()
    {
        if (photonView.IsMine)
        {
            dirX = CrossPlatformInputManager.GetAxis("Horizontal");
            if (dirX != 0)
            {
                barrel.up = Vector3.right * Mathf.Sign(dirX);
            }

            if (CrossPlatformInputManager.GetButtonDown("Jump"))
                Jump();

            if (CrossPlatformInputManager.GetButtonDown("Fire1"))
                Fire();

        }
        else
        {

        }
    }

    void FixedUpdate()
    {
        if (photonView.IsMine)
        {
            rb.velocity = new Vector2(dirX * moveSpeed, rb.velocity.y);
        }
    }

    void Jump()
    {
        if (photonView.IsMine)
        {
            if (rb.velocity.y == 0)
                rb.AddForce(Vector2.up * jumpForce);
        }
    }

    void Fire()
    {
        if (photonView.IsMine)
        {
            var firedBullet = Instantiate(bullet, barrel.position, barrel.rotation);
            firedBullet.AddForce(barrel.up * bulletSpeed);
        }
    }

    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.IsWriting)
        {
            stream.SendNext(health);
        }else if (stream.IsReading)
        {
           health = (float)stream.ReceiveNext();
        }
    }
    public void SetMaxHealth(int value)
    {
        if (photonView.IsMine)
        {
            slider.maxValue = value;
            // The property handles the rest anyway
            Health = value;
        }

    }
}
```