Trying to make a script where when a player joins and is on a certain team, the hats they are currently wearing are removed THEN replaced with a new hat. This is what I have so far, I don't know how to insert a hat from the ROBLOX catalog and weld it onto the player's head
local teams = {"British Army"} function isTeam(plr) for _,v in pairs(teams) do if game.Teams[v].TeamColor == plr.TeamColor then return true end end return false end game.Players.PlayerAdded:connect(function(np) np.CharacterAdded:connect(function(nc) if isTeam(np) then nc.ChildAdded:connect(function(item) if item:IsA("Accessory") then item:Destroy() end end) end end) end)
Thank you
First of all, Make it so the characters appearance doesn't load for this game. If you want you can use this script, its pretty self explanatory once you insert it into your game.
Just Remember to make the characters appearance not load for the British Army
https://www.roblox.com/library/150709829/Give-all-players-clothing-on-spawn