Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

0
so like a simple textlabel (Blue) over the head of a player that is on (Blue team) ? dominicjj54321 8 — 5y
0
Not on the head of the player,in their gui. Resetname2343 -5 — 5y
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 dominicjj54321 8 — 5y
0
you figured it out? Resetname2343 -5 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

--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)

1
My bad, im new to the site, and i don't know how to change the text into the script code dominicjj54321 8 — 5y
0
ether way this should work fine dominicjj54321 8 — 5y
0
Only problem with this one is that it only changes when the player resets to the new team dominicjj54321 8 — 5y
Ad

Answer this question