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

How do I make my model a wearable hat?

Asked by 5 years ago

So, I have this group of parts here, It is named helmet, How do I make the group wearable? Please help, anyone. The code I am trying to make work for this is here, If I did something wrong, please fix it.

debounce = true

function onTouched(hit)
    if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
        debounce = false
        h = Instance.new("Hat")
        p = Instance.new("Part")
        h.Name = "Helmet"
        p.Parent = h
        p.Position = hit.Parent:findFirstChild("Head").Position
        p.Name = "Handle" 
        p.formFactor = 0
        p.Size = Vector3.new(2, 1, 1) 
        p.BottomSurface = 0 
        p.TopSurface = 0 
        p.Locked = true 
        script.Parent.Mesh:clone().Parent = p
        h.Parent = hit.Parent
        h.AttachmentPos = Vector3.new(0, 0.3, 0)
        wait(5)
        debounce = true
    end
end

script.Parent.Touched:connect(onTouched)

If I did something wrong, you can see what I did in this link. https://docs.google.com/document/d/19b5i1IT4oVcmv0b6e3zpPgN9Rm2_GeOLlWnlI0uggsQ/edit Please help..

0
epic, in a google doc User#24403 69 — 5y
0
Hahaha. Yosufgamer -7 — 5y
0
Hats are deprecated. You should use Accessories instead. LawlR 182 — 5y
0
So you want it so when you join the game, the hat goes on your head? TypicallyPacific 61 — 5y
0
No, I want the hat to go onto your head when you step on it. Yosufgamer -7 — 5y

Answer this question