This is a simple scrip used by me to use a hat object for my Roblox player.
The script needs to be put on the root of the hat object.
If the hat has a bad orientation, then change the script variable AttachmentRight with a good vector.
Let’s see the script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | -- (catafest hat Script - Loaded.) 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 = "catafest_fedora" p.Parent = h p.Position = hit.Parent:findFirstChild("Head").Position p.Name = "Handle" p.formFactor = 0 p.Size = Vector3.new(1, 1.2, 1) p.BottomSurface = 0 p.TopSurface = 0 p.Locked = true script.Parent.Mesh:clone().Parent = p h.Parent = hit.Parent h.AttachmentForward = Vector3.new (-0, -0, -0) h.AttachmentPos = Vector3.new(0, -0.1, 0.05) h.AttachmentRight = Vector3.new (0, 0, 1) h.AttachmentUp = Vector3.new (0, 1, 0) wait(5) debounce = true end end script.Parent.Touched:connect(onTouched) |