Riley_Huntley

Untitled

Dec 4th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. debounce = true
  2.  
  3. function onTouched(hit)
  4. if (hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == true) then
  5. debounce = false
  6. h = Instance.new("Hat")
  7. p = Instance.new("Part")
  8. h.Name = "Hat" -- It doesn't make a difference, but if you want to make your place in Explorer neater, change this to the name of your hat.
  9. p.Parent = h
  10. p.Position = hit.Parent:findFirstChild("Head").Position
  11. p.Name = "Handle"
  12. p.formFactor = 0
  13. p.Size = Vector3.new(-0,-0,-1)
  14. p.BottomSurface = 0
  15. p.TopSurface = 0
  16. p.Locked = true
  17. script.Parent.Mesh:clone().Parent = p
  18. h.Parent = hit.Parent
  19. h.AttachmentPos = Vector3.new(0, -1.6, -0.55) -- Change these to change the positiones of your hat, as I said earlier.
  20. wait(5) debounce = true
  21. end
  22. end
  23.  
  24. script.Parent.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment