Team Hats: How to Add Accessories Based on Teams in Roblox

Published 2020-10-30
In this Roblox Development video I show you how to add a hat based on the player's team. I create two teams, Red and White, and two hats, RedHat and WhiteHat. When the player enters the game, they get the hat with the team color.

All Comments (21)
  • YES EXACTLY WHAT I WANTED!! YOUR CHANNEL HAS LITERALLY THE BEST CONTENT SO FAR....ALL those Devking and Alvinblox just miss out at these kinds of things! You are superb!
  • @Bayarboldddddd
    local ss = game:GetService("ServerStorage") local function playerAdded(player) player.CharacterAdded:Connect(function(char) local hat = nil if player.Team.Name == "Your team name" then hat = ss:WaitForChild("Your hat"):Clone() elseif player.Team.Name == "Your team name" then hat = ss:WaitForChild("Your other hat"):Clone() end local hum = char:WaitForChild("Humanoid") hum:AddAccessory(hat) end) end game.Players.PlayerAdded:Connect(playerAdded)
  • @melonman7712
    Thank you, no one else has ever done this, just thank you.
  • @apodev9879
    Really helpful. im trying to make it where certain teams have certain starter characters. really helpful. your amazing thank you!
  • @rkgrafics
    another great job mate. i would like to learn more about the Team system. can you make a follow-up tut. that when players join the game, they got a GUI to select witch Team they can join? for me, i need it so a player can choose what kind of fighter he chooses to be, and hopefully add differant weapons/spells(like your fireball) each kind of player is starting with. if you can help out with a tut. that would be great!
  • @FlyBeastGames
    Can you make a part that has a e to open gui and when you open a gui it will teleport the camera into a room and customize your gear like you can add things on the belt like a gun holster etc.. also team only i hope you read it :)
  • Is there a way you can give a team a "logo" or certain decal that only is part of that team
  • @63iv67
    How do I make it so that red team only has 1 person on it and white can have as many
  • @fatherjamie5149
    Thanks that helped me now i can get my auto team uniform and hat for my military thanks dude!
  • @oramasol5610
    How do I make it so I remove the players current hats after the team hats are equipped?
  • @zennyvideos
    how do you disable a localscript by pressing a textbutton? (CONTEXT: i added a motionblur for my game, and its a local script. but I wanted a Settings GUI to have an option to disable it and enable it for low-end users. so ya)
  • @MooojinIsRandom
    Can u make a tutorial that there is a way depending on the team you come in the game as a different morph
  • @game32jjjj
    Script: local ss = game:GetService("ServerStorage") -By game32jjjj- local function playerAdded(player) player.CharacterAdded:Connect (function (char) local hat = nil if player.Team.Name == "Army" then hat = ss:WaitForChild("WhiteHat") :Clone() end end) end But he not work why?
  • @dopedrums
    I really like this tutorial as I've been searching for months on how to do this. However, most team games (I'm thinking FPS games) will not run around with a modelled top hat, they run around with colored clothing. Is it possible to make a follow-up video and expand on that? How to add a red t-shirt, pants to the red team and blue clothing for the blue team? This can't be found on Youtube at all so it would be a rare gem!
  • how can I make it so it has all of their accessories removed but keeps the one I want?
  • @dmfcopple9531
    Can this work with meshes? I am trying to make armor for different teams and I need someone to help me with it..
  • @yanal62
    how do you make it delete the hat they are already wearing