Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

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

Asked by 9 days 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 1726 — 9d
0
Then how do I fix it? vincentthecat1 -3 — 9d
0
So like speacial mesh? vincentthecat1 -3 — 9d
0
I guess you can do that Mr_Unlucky 366 — 9d

2 answers

Log in to vote
1
Answered by 9 days 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.

0
Like exactly how do I do that? vincentthecat1 -3 — 8d
Ad
Log in to vote
0
Answered by 9 days 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