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

Making wearable hats out of models/meshes?

Asked by
corbenv 17
5 years ago

Ok, so I made some hats that I want the character to be able to wear, but I don't know how to do that and google isn't very much of a help either. The hats are models, but I could turn them into texture baked meshes if needed. How would I make a mesh/model wearable? There is no script but I don't know where else I should ask this.

1 answer

Log in to vote
0
Answered by
1ov3y0u 51
5 years ago
Edited 5 years ago

All you need to do is upload your mesh to Roblox, upload the texture, and create an instance named Mesh. Create a TouchInterest. Add this script to the hat:

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 = "YourHatName"
        p.Parent = h
        p.Position = hit.Parent:findFirstChild("Head").Position
        p.Name = "Handle" 
        p.formFactor = 0
        p.Size = Vector3.new(0,-0.25,0) 
        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.25,0)
        wait(5)
        debounce = true
    end
end

script.Parent.Touched:connect(onTouched)

and then the hat should be on your head. Note: You need to make a Hat instance, put the mesh in the Handle inside your hat, then follow the steps. A model is harder, all I know is how to do it with a mesh.

Ad

Answer this question