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

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

Asked by
Krlos21 45
10 years ago
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
The whole team? Or a specific person. Shawnyg 4330 — 10y

1 answer

Log in to vote
0
Answered by 6 years ago

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.

Ad

Answer this question