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 5 years ago

So I have been trying to find something like this and I found some that's 5 years old but what I need is to touch a block and get a hat put on my head but I some how cant find out how to and this is what I found and it works! But I thought I found it but it was wrong so can you help me with it? |Script|

shirtid = "http://www.roblox.com/asset/?id=751061408"
pantsid = "http://www.roblox.com/asset/?id=1134006219"
accessoryid = "https://web.roblox.com/catalog/416833190/Tokyokhaos-Lion"

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
         if char:findFirstChild("Accesory") then
             char.Pants.PantsTemplate = pantsid
         else
             b = Instance.new("Accessory", char)
             b.Name = "Accessory"
             b.HatTemplate = accessorysid
         end
     end
 end)

|Info| The clothing part works its just the hat part the dose not! |Warning!| Anybody can use the fixed script!

0
Accessories don't have a property called HatTemplate theking48989987 2147 — 5y
0
Then how do I fix it? vincentthecat1 199 — 5y
0
So like speacial mesh? vincentthecat1 199 — 5y
0
I guess you can do that Mr_Unlucky 1085 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

Roblox put a new system in place to do this easily.

https://devforum.roblox.com/t/new-api-for-equipping-assets-on-humanoid-player-avatars/233076 https://developer.roblox.com/articles/humanoiddescription-system

You can create or pre-make HumanoidDescriptions and apply them once they touch a part. Make sure you add debounces to the touched event so it doesn't apply it too many times.

Ad
Log in to vote
0
Answered by 5 years ago

Accessories have Handles, like tools. You can add a special mesh inside of the Handle (The Handle HAS to be a part named Handle). and then you can change the special mesh

Answer this question