How do I hide UI depending on what player is in the game?

So I’m making a 4 player local arena game. An I have the HUD set up to work but i Need to hide portions of the hud depending on how many players are playing.

I have been messing around in the hidden function for a while but I cant get it to work. Im trying to hide the UI based on the controller ID in the game, so if player 4 is not in the game - hide the UI for player for.

It seem like it would be an easy problem to solve but i’m just a noob and would appreciate any help i can get.


I would say have all of your player controllers in an array, have a second array with the “parts of the HUD” and each one corresponding to the same index in both arrays. So player 0 is at the 0 index of the controller array and the corresponding HUD is at the 0 index of the “HUD parts” array. Then have a function that does a “for each loop” runs through the array and checks if each the controller index is valid, if yes “set visibility” of that HUD section to “visible” if it is not valid “set visibility” to false.