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

Is this script right ? For giving specific player a new shirt pants and hat ??

Asked by
Krlos21 45
9 years ago

I have put this in a localscript inside the Starter GUI but it's not working what im trying to do is to choose one player and remove its clothes and hats and give it a new shirt pants and hat which would be different than others "I think there's something wrong with the hat selection part" help please and I'll give credit thanks

assets={}
    assets.Shirt{90415298,114883953,140974162,81050287,112047296,92448971} --Shirts
    assets.Pants{65160698,89224181,67492557 } 
    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 

1 answer

Log in to vote
0
Answered by
HexC3D 830 Moderation Voter
9 years ago

First Of all I've tried this and it won't work to change the Asset ID of the shirt at all in the game. So just Clone shirt into the player and remove the current shirt in there.

+1 if this helped also sorry for all that trouble of changing the script but hey, that happened to me, we all find out the hard way, sadly :(.

Ad

Answer this question