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

Putting on clothes when you click a GUI?

Im trying to make a script so when you click a GUI it will put shirts and pants on your character

This is what I have right now

shirtid = "http://www.roblox.com/asset/?id=146978987"
pantsid = "http://www.roblox.com/asset/?id=54361253"
button = script.Parent

button.MouseButton1Click:conect(function()
    if hit.Parent:findFirstChild("Humanoid")then
        char = hit.Parent
        if char:findFirstChild("Shirt") then
            char.Shirt.ShirtTemplate = shirtid
        else
            a = Instance.new("Shirt", char)
            a.Name = "Shirt"
            a.ShirtTemplate = shirtid
        end
        if char:findFirstChild("Pants") then
            char.Pants.PantsTemplate = pantsid
        else
            b = Instance.new("Pants", char)
            b.Name = "Pants"
            b.PantsTemplate = pantsid
        end
    end
end)

2 answers

✓ Accepted answer

Here, I can fix it up a little bit:

--Put this in a local script inside the textbutton
shirtid = "http://www.roblox.com/asset/?id=146978987"
pantsid = "http://www.roblox.com/asset/?id=54361253"
button = script.Parent

button.MouseButton1Click:conect(function()
    player = game.Players.LocalPlayer
        char = player.Character
        if char:findFirstChild("Shirt") then
            char.Shirt.ShirtTemplate = shirtid
        else
            a = Instance.new("Shirt", char)
            a.Name = "Shirt"
            a.ShirtTemplate = shirtid
        end
        if char:findFirstChild("Pants") then
            char.Pants.PantsTemplate = pantsid
        else
            b = Instance.new("Pants", char)
            b.Name = "Pants"
            b.PantsTemplate = pantsid
        end
end)

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