Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[Unsolved] How do I give clothes to a whole team different from the other team?

assets={}
    assets.Shirt{90415298,114883953} --Shirts
    assets.Pants{65160698,89224181, } 
    assets.Hats= game.Lighting.Hats:GetChildren() -- hats go in a model under lighting called Hats

player =  game.Players.LocalPlayer -- gets the player
a = player .Character:GetChildren() -- Gets parts used for cleaning

function Clear() -- Removes hats Character meshes shirts and pants also T-shirts
for xX = 1,#a do
    if a[xX].ClassName=="Hat" or a[xX].ClassName=="CharacterMesh" or a[xX].ClassName=="Shirt" or  a[xX].ClassName=="Pants" or a[xX].ClassName=="ShirtGraphic" then
        a[xX]:Destroy()

    elseif a[xX].ClassName=="Part" and a[xX].Name~="HumanoidRootPart" then a[xX].Transparency = 0 
     end
    end
  end

Clear() -- Cleans the player
wait()
Shirt = Instance.new("Shirt",player.Character) shirts.Name = "Shirts"
pants = Instance.new("Pants",player.Character) pants.Name = "Pants"
hat = assets.Hats[math.random(1,#assets.Hats)]:Clone()
Shirt.ShirtTemplate = "rbxassetid://" .. assets.Shirt[math.random(1,#assets.Shirt)]
pants.PantsTemplate = "rbxassetid://" .. assets.Pants[math.random(1,#assets.Pants)]
hat.Parent = player.Character 

This is in a Local Script inside Starter GUI but it wont work what I'm trying to do is to give clothes to the whole team players which are different to the other team. Thank You for the help

1 comment

1

The whole team? Or a specific person.

1 answer

Here's the script I use!

wait(1)
local team = game.Players.LocalPlayer.Team.Name
local stuffInScript = script[team]:GetChildren()

local charGet = game.Players.LocalPlayer.Character:GetChildren()
for i = 1, #charGet do
	if charGet[i].className == "Shirt" or charGet[i].className == "Pants" then
		charGet[i]:Destroy()
	end
	if charGet[i].className == "Hat" then
		charGet[i]:Destroy()
	end
end

for i = 1, #stuffInScript do
	stuffInScript[i].Parent = game.Players.LocalPlayer.Character
end

Put the script(local script) in starter GUI, and put a folder inside of it for each team that has the same name as the team, in that folder put a shirt and pants.

This discussion is preserved as it was. New answers, comments, and votes are closed.