Advertisement
Qwartarz

Untitled

May 11th, 2015
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. pellet = script.Parent
  2. damage = 1
  3. local debounce = false
  4.  
  5.  
  6. function onTouched(hit)
  7. if debounce == false then
  8. debounce = true
  9. if welded == false and hit.Parent:findFirstChild("Arrow") == nil then stick(hit) end
  10. humanoid = hit.Parent:findFirstChild("Enemy")
  11. if humanoid~=nil then
  12. tagHumanoid(humanoid)
  13. humanoid.Health = humanoid.Health - damage
  14. wait(2)
  15. untagHumanoid(humanoid)
  16. else
  17. wait(2)
  18. connection:disconnect()
  19. end
  20. end
  21. debounce = false
  22. end
  23.  
  24. function tagHumanoid(humanoid)
  25. -- todo: make tag expire
  26. local tag = pellet:findFirstChild("creator")
  27. if tag ~= nil then
  28. local new_tag = tag:clone()
  29. new_tag.Parent = humanoid
  30.  
  31. end
  32. end
  33.  
  34.  
  35. function untagHumanoid(humanoid)
  36. if humanoid ~= nil then
  37. local tag = humanoid:findFirstChild("creator")
  38. if tag ~= nil then
  39.  
  40. tag.Parent = nil
  41. end
  42. end
  43. end
  44.  
  45. connection = pellet.Touched:connect(onTouched)
  46.  
  47. wait(1)
  48. if welded then wait(1) end
  49. pellet.Parent = nil
  50. BCGamesSH is not online. BCGamesSH
  51.  
  52. Joined: 03 May 2012
  53. Total Posts: 21
  54. #67,464,741 - 05-04-2012 09:29 AM
  55. Ok. Your error lies within a misplace debounce change.
  56.  
  57.  
  58. This is how your format is:
  59.  
  60. local db = false
  61.  
  62. function blah()
  63. if db == false then
  64. db = true
  65. -- blahhh
  66.  
  67. end
  68. db = false
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement