Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make different teams spawn with different hats? [NOT ANSWERED]

Asked by 9 years ago

So I have a pretty good uniform script that changes the player's clothes when they enter the game and choose a team. However, I want the players to spawn with hats as well, when they choose a team. I'm terribly stuck on how to do this.

1 answer

Log in to vote
0
Answered by 9 years ago

What you would want to do is get whatever hat(s) you want to use and place them somewhere, lets put it in ServerStorage. Now, I'll just make an example of two hats I made up, Hat1 and Hat2. These Hats are now in ServerStorage and we will be using a regular Script.

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)
0
Still not working for me. The hats are originally parts with a special mesh so is that why it isn't working? (They are not official ROBLOX hats) BartyCrouchJunior 57 — 9y
0
you know for a fact, alpha, you shouldn't use remove(). unmiss 337 — 9y
0
This still isn't working..anything else I could do? BartyCrouchJunior 57 — 9y
Ad

Answer this question