Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can somebody tell me how do I make a textlabel show the team the player is currently on?

I've been trying for a few hours to do this,but it just wouldn't work.

4 comments

0

so like a simple textlabel (Blue) over the head of a player that is on (Blue team) ?

0

Not on the head of the player,in their gui.

0

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

0

you figured it out?

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

1

My bad, im new to the site, and i don't know how to change the text into the script code

0

ether way this should work fine

0

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.