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

How do I put clothes on a character when they touch a door?

Asked by 10 years ago

I want to make it so when a Player touches a door, it puts a certain Shirt and Pants on them. Does anyone know how to do this?

1 answer

Log in to vote
3
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I'm not 100% sure this would work, but it goes along the lines of this. You can test it out anyways.

To find out the shirt ID of your shirt/pants (In case the ID in the URL doesn't work), do this.

  1. Make sure that you're wearing the shirt/pants.
  2. Open up ROBLOX Studio
  3. Click Tools>Test>Play Solo
  4. Go into Workspace and find your character
  5. Find your shirt/pants and the first property should be the id!
shirtid = "http://www.roblox.com/asset/?id="
pantsid = "http://www.roblox.com/asset/?id="

script.Parent.Touched:connect(function(hit)
    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)

-Thank me by accepting this answer/bumping up my reputation!

Ad

Answer this question