Advertisement
Qwartarz

Untitled

May 11th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. pellet = script.Parent
  2. damage = 1
  3. local debounce = false
  4.  
  5.  
  6. function onTouched(hit)
  7. debounce = true
  8. if welded == false and hit.Parent:findFirstChild("Arrow") == nil then stick(hit) end
  9. humanoid = hit.Parent:findFirstChild("Enemy")
  10. if humanoid~=nil then
  11. tagHumanoid(humanoid)
  12. humanoid.Health = humanoid.Health - damage
  13. wait(2)
  14. untagHumanoid(humanoid)
  15. else
  16. wait(2)
  17. connection:disconnect()
  18. end
  19. debounce = false
  20. end
  21.  
  22. function tagHumanoid(humanoid)
  23. -- todo: make tag expire
  24. local tag = pellet:findFirstChild("creator")
  25. if tag ~= nil then
  26. local new_tag = tag:clone()
  27. new_tag.Parent = humanoid
  28.  
  29. end
  30. end
  31.  
  32.  
  33. function untagHumanoid(humanoid)
  34. if humanoid ~= nil then
  35. local tag = humanoid:findFirstChild("creator")
  36. if tag ~= nil then
  37.  
  38. tag.Parent = nil
  39. end
  40. end
  41. end
  42.  
  43. connection = pellet.Touched:connect(onTouched)
  44.  
  45. wait(2)
  46. if welded then wait(2) end
  47. pellet.Parent = nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement