I've asked this question twice before, got some feedback and edited my script only to find that it still isn't working. It is supposed to give players a hat depending on what team they're on. Here is my code:
game.Players.PlayerAdded:connect(function(Plr)
Plr.CharacterAdded:connect(function(Char)
local Contents = Char:GetChildren()
for _, v in pairs(Contents) -- Remove all existing hats to add new one(s)
if v:IsA("Hat") then
v:remove()
end
end
if Plr.TeamColor == BrickColor.new("Bright blue") then -- Check the team Color
local Hat1 = game.ServerStorage.Hat1:Clone()
Hat1.Parent = Char
elseif Plr.TeamColor == BrickColor.new("Bright red") then
local Hat2 = game.ServerStorage.Hat2:Clone()
Hat2.Parent = Char
end
end)
end)

2 comments
Thank you, I can't believe I overlooked that. It works perfectly now :)
What about face(hat) and hair?