Would my code work for setting multiple players into a Billboard GUI's "HideFromPlayer?"

I coded what I think hides players from a player’s own billboard gui (including himself) I don’t know if it overwrites a part of the array though–I have a feeling it does.

The objective is to have these two teams not be able to see the gui along with the player itself.

                for i,v in pairs(game.Teams["Team1"]:GetPlayers()) do
					player.Character.Head.BillboardGui.PlayerToHideFrom=v
				end
				
				for i,v in pairs(game.Teams["Team2"]:GetPlayers()) do
					player.Character.Head.BillboardGui.PlayerToHideFrom=v
				end
				
				player.Character.Head.BillboardGui.PlayerToHideFrom=player --hide gui from player itself
				
1 Like

The thing is, PlayerToHideFrom can only accept a single Instance of a Player (Which is honestly a bit confusing in general)

You could just reference it as a LocalScript, and just check if the Player’s Teams are either not or equal to the same Team Color, then Enable their GUI’s that way

1 Like

Okay, I had initially done a local script (with different code not pertaining to playertohidefrom) to do this but I had obtained info that had stated it could take multiple players, guess they were wrong.