plr = game.Players.LocalPlayer
script.Parent.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
local d = script.Parent.Parent:GetChildren() 
for i=1, #d do 
if (d[i].className == "Accessory") and (d[i].Name ~= "Cowl") then 
d[i]:Destroy() 
end 
end
local hat = Instance.new("Accessory")
hat.Name = "Cowl"
local hatpart = Instance.new("Part")
hatpart.Position = script.Parent.Parent:findFirstChild("Head").Position
hatpart.Name = "Handle"
hatpart.Size = Vector3.new(1, 0.4, 1) 
script.Parent.HatHandle.Mesh:Clone().Parent = hatpart
hatpart.Parent = hat
hatpart.BottomSurface = 0 
hatpart.TopSurface = 0
hatpart.CanCollide = false
hat.Parent = script.Parent.Parent
hat.AttachmentForward = Vector3.new (-0, -0, -1)
hat.AttachmentPos = Vector3.new(0, 0.4, 0)
hat.AttachmentRight = Vector3.new (1, 0, 0)
hat.AttachmentUp = Vector3.new (0, 1, 0)
if script.Parent.HatHandle ~= nil then
script.Parent.HatHandle:Destroy()
end
end)
end)

In the script, it gives me a hat, but instead of staying on my head, it falls through me and does stay.

3 comments

0

And no errors in output

0

Make sure its wielded to the head once you touch/ equip the hat

0

Any update on this?