I’m trying to make a game which has a scoring system similar to volleyball. If the ball bounces two times on either side, the other team gets a point. If the ball bounces in the far end of the court one time the other team gets a point. I’m trying to display a widget showing something like “you win” on the winner’s screen an “you lose” on the loser’s screen. In the future i’d like to be able to play an animation, similar to how wii sports does it with the win/loss screen in the tennis game mode.
The intuitive way is to traverse all players and based on their team (winning or losing) you add the right widget to their screen.
You’ve already got PlayerArray in GameState, which is an array of all PlayerStates. Have an identifier in your PlayerState class for what team the player is in. In your GameMode class (the one who says the game is over) once the game is over you call a function that traverses that array, and for each element (PlayerState) based on whether they are winning/losing team you call a client RPC that adds a widget to that player’s screen.
Note that we call a client RPC as widgets are local (client-only usually). Also, for reference you can see a function that does something similar: