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.
COMMUNITY QUESTION
Making wearable hats out of models/meshes?
1 answer
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.
