I've been trying for a few hours to do this,but it just wouldn't work.
--Just put the Gui in the corrisponding team.
function teamFromColor(color)
for _,t in pairs(game:GetService("Teams"):GetChildren()) do
if t.TeamColor==color then return t end
end
return nil
end
function onSpawned(plr)
local gui = teamFromColor(plr.TeamColor):GetChildren()
for _,c in pairs(gui) do
c:Clone().Parent = plr.PlayerGui
end
end
function onChanged(prop,plr)
if prop=="Character" then
onSpawned(plr)
end
end
function onAdded(plr)
plr.Changed:connect(function(prop)
onChanged(prop,plr)
end)
end
game.Players.PlayerAdded:connect(onAdded)