Advertisement
Guest User

Hat Giver

a guest
Nov 22nd, 2017
808
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 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.25,0)
  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, 0, 0) -- Change these to change the positiones of your hat, as I said earlier.
  20.         wait(5)
  21.         debounce = true
  22.     end
  23. end
  24.  
  25. script.Parent.Touched:connect(onTouched)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement