Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Scoring System not working in Multiplayer !

Discussion in 'Scripting' started by Loaiq1107, Feb 2, 2016.

  1. Loaiq1107

    Loaiq1107

    Joined:
    Aug 25, 2014
    Posts:
    48
    I'm making a multiplayer game and my scoring system is not working perfectly ! when i kill a player it's supposed to show the score on both sides : the player that killed and the player who was killed.
    But it only adds score to one screen (which is the dead player). for example :

    i kill a player , it adds one point to my team's score on that player's screen (the dead one), and remains the same score on my screen !!!

    Here's the code :
    Code (CSharp):
    1.     if (PlayerHealth <= 0) {
    2.             PlayerHealth = 0;
    3.  
    4.             if (gameObject.tag == "Player1") {
    5.                 Team2Points++;
    6.             }
    7.  
    8.             if (gameObject.tag == "Player2") {
    9.                 Team1Points++;
    10.             }
    I Know that the problem is that i only added points on the Player who died (the gameObject) , but i dont know how to fix it ;/

    Any help would be HUGELY appreciated!
    thanks:)
     
  2. bigmisterb

    bigmisterb

    Joined:
    Nov 6, 2010
    Posts:
    4,221
  3. Loaiq1107

    Loaiq1107

    Joined:
    Aug 25, 2014
    Posts:
    48
    i didn't find out how to do it :( if you can write the code or just the idea of it that would be really helpful :) thanks.