Not detecting TeamColor from script in Character

I’ve placed a script into StarterCharacterScript so that if a player is part of a certain team, a billboard GUI under the script copies to the character’s head. For some reason, it’s not even detecting the team colour. Nothing is being printed either which is really confusing me as I haven’t got a clue on the problem.

Here’s the script I am using under StarterCharacterScripts:

local BillboardGUI = script.TeamAndClass
local Character = script.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local Head = Character:WaitForChild("Head")

if Player.TeamColor == BrickColor.new("White") then
	print ("White Team")
	BillboardGUI.Parent = Head
end

Cheers.

The script you’ve posted has worked perfectly fine for me and has printed correctly. Are you sure you’re testing with the right team color?

Yeah, I haven’t got a clue what’s going on.

That’s an easy one, first the problem is because you used if statement and it already checked and the game found it’s yet not the colour team. you could use an easy fix with Team.PlayerAdded to check if a player joined a specific team!

local BillboardGUI = script.TeamAndClass

local Character = script.Parent

local Player = game.Players:GetPlayerFromCharacter(Character)

local Head = Character:WaitForChild("Head")

print(Player)

game.Teams.WhiteTeam.PlayerAdded:Connect(function(Player) -- Re write this to whatever team you want

    print ("White Team")
    BillboardGUI.Parent = Head

end)

Ah, guess I am numpty. Should have stuck with that idea.