I've been trying for a few hours to do this,but it just wouldn't work.
Can somebody tell me how do I make a textlabel show the team the player is currently on?
1 answer
--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)
3 comments
My bad, im new to the site, and i don't know how to change the text into the script code
ether way this should work fine
Only problem with this one is that it only changes when the player resets to the new team
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
so like a simple textlabel (Blue) over the head of a player that is on (Blue team) ?
Not on the head of the player,in their gui.
unfortunately during the FE -> EX update, Roblox has changed the way player Gui works, im working on something, ill see if i can get it to work
you figured it out?