Help With Destroying a Player's Hat On Spawn

I currently have a StarterCharacter model in the StarterPlayer folder to change the appearance of each player when they spawn. The StarterCharacter is wearing a hat. I would like the hat to be destroyed once the player spawns in IF they are on a certain team.

Any advice? Thanks in advance.

1 Like
game.Players.PlayerAdded:Connect(function(Player)
   Player.CharacterAdded:Connect(function(Char)
         If Char:FindFirstChild("Hat") and Player.Team == game.Teams.Team then
             Char.Hat:Destroy()
        end
   end)
end)

Where would I input the team name? For example, if the team was called “Red Team”?

Disable the character’s appearance loading, search this bool in the starterplayer properties.

and Player.Team == game.Teams["Red Team"]