Hi, I have been trying to come up with a way to create this into a click hat giver rather than a ontouch hat giver. I have added a click detector, what would I need to do to convert this into a click giver?
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 = "Hat"
p.Parent = h
p.Position = hit.Parent:findFirstChild("Head").Position
p.Name = "Handle"
p.formFactor = 0
p.Size = Vector3.new(-0,-0,-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.4,-0.025)
wait(5) debounce = true
end
end
script.Parent.Touched:connect(onTouched)

1 comment
No, this doesn't happen to work, thank you for your answer though.