game.Players.PlayerAdded:connect(function(Plr)
Plr.CharacterAdded:connect(function(Char)
wait(0.5)
local Contents = Char:GetChildren()
for _, v in pairs(Contents) do
if v:IsA("Accessory") then
v:remove()
end
end
if Plr.TeamColor == BrickColor.new("Bright blue") then
local Hat1 = game.ServerStorage.Hat1:Clone()
Hat1.Parent = Char
elseif Plr.TeamColor == BrickColor.new("Bright red") then
local Hat2 = game.ServerStorage.Hat2:Clone()
Hat2.Parent = Char
end
end)
end)
I have put actual hat models in ServerStorage and it works. The problem with this script is mainly bc it only works for one single hat per team.
I want to add other hats named as Hat3, Hat4, etc. (a combination of hats would be better)
I've heard of math random but I am not familiar with it (I'm learning to script)
So, the question is... how would I make random hats generate on a user on a specified team?
