The text label I have that is supposed to show the player’s team isn’t working. The rank and name work fine, however I am having issues with the team part.
Code:
local frame = ui.Frame
local VisitorColour = Color3.fromRGB(163, 162, 165)
local StudentColour = Color3.fromRGB(248, 248, 248)
local StaffColour = Color3.fromRGB(13, 105, 172)
local CouncilColour = Color3.fromRGB(128, 187, 219)
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(chr)
team.Text = plr.Team
if plr.Team == "Visitor" then
team.TextColor3 = VisitorColour
elseif Player.Team == "Student" then
team.TextColor3 = StudentColour
elseif Player.Team == "Staff" then
team.TextColor3 = StaffColour
elseif Player.Team == "Council" then
team.TextColor3 = CouncilColour
end
end)
end)
[ui is a pre-defined variable that I use through the whole script, I use it for the player’s name and rank and it works fine.]
[Edit] you might also want to make sure you’re guaranteeing that the team is being set before you run this code, like so:
plr:GetPropertyChangedSignal("Team"):Connect(function()
-- do code to adjust the team text again since our team changed
end)
This would happen outside of CharacterAdded and inside of PlayerAdded. You will also have to run your code if you do find a team right when the player was added.