So, I made a script in which it gives uniforms to the teams, and a hat. The uniforms clothing shirts and pants show up and work fine, but the hats don't show up. I placed a hat object into Lighting then I placed the model of the hat as it's child. How can I fix the problem in which the hat doesn't show up?
local team1 = game.Teams:findFirstChild("Germans")
local team2 = game.Teams:findFirstChild("U.S. Army")
-- put the team name, not color
local t1shirt = game.Lighting:findFirstChild("RedShirt")
local t2shirt = game.Lighting:findFirstChild("GreenShirt")
local t1hat = game.Lighting:findFirstChild("RedHat")
local t2hat = game.Lighting:findFirstChild("GreenHat")
local t1pants = game.Lighting:findFirstChild("RedPants")
local t2pants = game.Lighting:findFirstChild("GreenPants")
--put the clothes and pants in lighting and put their name there
function onSpawn(player)
wait(1) -- takes time for the clothes to load
local clothing = player.Character:GetChildren()
for i = 1, #clothing do -- my favorite line in scripting, this is so uesful in everything
if clothing[i].className == "Pants" or clothing[i].className == "Shirt" or clothing[i].className == "Hat" then
clothing[i]:remove() -- removes the clothes of course
end
end
if player.TeamColor == team1.TeamColor then
t1shirt:Clone().Parent = player.Character
t1pants:Clone().Parent = player.Character
t1hat:Clone().Parent = player.Character -- puts uniforms into the person
end
if player.TeamColor == team2.TeamColor then
t2shirt:Clone().Parent = player.Character
t2pants:Clone().Parent = player.Character
t2hat:Clone().Parent = player.Character
end
end
function A(new) -- this function connects the player to the function above whenever the person respawns
new.Changed:connect(function(N) if N == "Character" then onSpawn(new) end end)
end
game.Players.ChildAdded:connect(A)

3 comments
On Line 52 Should be game.Players.PlayerAdded.
Hats are annoying, you have to weld them. After line 40, create a weld, assing part0 as the part the hat is, assign part1 as the character's head, parent the weld to the hat or head, parent the hat to the character, and set C0 to CFrame.new(0,0,0)
Can you show me how? I'm kind of confused.