Unity Multiplayer: when i hit another player all players health bars go down
i am using OnTriggerEnter colliders to register hits with a sword, when the sword collider hits a collider with the tag player it reduces the health bar. the problem is that when i hit another player both the health bars go down, im pretty sure that this is happening because all players have the same tag as i need it to work for multiplayer but i dont know how to fix it
here is my code:
private void OnTriggerEnter(Collider other)
{
if (enter)
{
if (other.gameObject.tag == "Player")
{
healthbar.value -= 20;
}
}
}
Thank you for your time
p.s this is also my first game
Your answer
Follow this Question
Related Questions
Bullet Damage Player's Healthbar,Bullet Damage Other Player's Health 2 Answers
Kill Count and Health Bar Scripts 0 Answers
How do I check if a function has been called recently? 1 Answer
How to make GUI variables compatible with the UI system? 0 Answers
How do I make my healthbar change color depending on damage? 1 Answer