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

Change Clothes When TextButton IsClicked?

so player clicks the buttons and changes his clothes But this Local script is not working. Local Script Is Not Mine. But i tried to fix still dont works so i came here to ask for help.

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

button.MouseButton1Click:Connect(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)

3 comments

0

Is this a script or a Localscript?

0

Make sure to add a line that tells the system what "mouse" is

0

what u mean? mouse is..

1 answer

✓ Accepted answer

The problem is not the script, when getting clothing id's, you need to subtract one from the Id. For example, your first Id 478566599 should be 478566598

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