I asked this question before, but I am still stuck on what to do. 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("Really blue") then -- Check the team Color
            local Hat1 = game.ServerStorage:Clone()
            Hat1.Parent = Char
        elseif Plr.TeamColor == BrickColor.new("Really red") then
            local Hat2 = game.ServerStorage:Clone()
            Hat2.Parent = Char
        end
    end)
end)

6 comments

0

This looks right. Is it a server script?

0

Yes, it's in Workspace

0

Why are you cloning ServerStorage? shouldnt you clone one of its children??

0

I don't know, I'm stuck.

0

Look up a freemodel morph script.

0

I'm not looking for a morph script. I want the player's hats to change when they enter the game and choose a team.