game.Players.PlayerAdded:Connect(function(Plr)
Plr.CharacterAdded:Connect(function(chr)
local tp = game.Teams["Test Team"]:GetChildren()
local tp2 = game.Teams["Test Team 2"]:GetChildren()
if Plr.TeamColor == BrickColor.new("Black") then
local BBG = script.Black:Clone()
BBG.Parent = chr.Head
for i = 1, #tp2 do
while true do
wait()
BBG.PlayerToHideNameFrom = tp[i]
end
end
end
if Plr.TeamColor == BrickColor.new("White") then
local WBG = script.White:Clone()
WBG.Parent = chr.Head
for i = 1, #tp do
while true do
wait()
WBG.PlayerToHideNameFrom = tp[i]
end
end
end
end)
end)
This for some reason will not work and will show both guis.

2 comments
Hide the GUI individually on each client rather than the server.
Why do you have a while true loop after cloning each the GUI?