Advertisement
IHATEMICROWAVEOVEN

ype advantages 3

Nov 21st, 2021
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. function DamageService:RegisterHeal(Handler, Target, Heal)
  2. if Heal < 0 then return false end
  3. if DamageService:CanHeal(Handler, Target) then
  4. if Target:IsA'Player' then
  5. Target.Character.Humanoid.Health = Target.Character.Humanoid.Health + Heal
  6. else
  7. Target.Humanoid.Health = Target.Humanoid.Health + Heal
  8. end
  9. return true
  10. end
  11. return false
  12. end
  13.  
  14. function DamageService:RegisterWeaponPart(Handler, Parts, Damage, OnHitFunc, Type)
  15. spawn(function()
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. local attacktype
  27. if not Type then attacktype = None else
  28. local tupe = string.upper(tostring(Type))
  29. if tupe == "1" or tupe == "NOR" or tupe == "NORMAL" then attacktype = Normal end
  30. if tupe == "2" or tupe == "FIR" or tupe == "FIRE" then attacktype = Fire end
  31. if tupe == "3" or tupe == "WAT" or tupe == "WATER" then attacktype = Water end
  32. if tupe == "4" or tupe == "ELE" or tupe == "ELECTRIC" then attacktype = Electric end
  33. if tupe == "5" or tupe == "GRA" or tupe == "GRASS" then attacktype = Grass end
  34. if tupe == "6" or tupe == "ICE" then attacktype = Ice end
  35. if tupe == "7" or tupe == "FIG" or tupe == "FIGHTING" then attacktype = Fighting end
  36. if tupe == "8" or tupe == "POI" or tupe == "POISON" then attacktype = Poison end
  37. if tupe == "9" or tupe == "GRO" or tupe == "GROUND" then attacktype = Ground end
  38. if tupe == "10" or tupe == "FLY" or tupe == "FLYING" then attacktype = Flying end
  39. if tupe == "11" or tupe == "PSY" or tupe == "PSYCHIC" then attacktype = Psychic end
  40. if tupe == "12" or tupe == "BUG" then attacktype = Bug end
  41. if tupe == "13" or tupe == "ROC" or tupe == "ROCK" then attacktype = Rock end
  42. if tupe == "14" or tupe == "GHO" or tupe == "GHOST" then attacktype = Ghost end
  43. if tupe == "15" or tupe == "DRA" or tupe == "DRAGON" then attacktype = Dragon end
  44. if tupe == "16" or tupe == "DAR" or tupe == "DARK" then attacktype = Dark end
  45. if tupe == "17" or tupe == "STE" or tupe == "STEEL" then attacktype = Steel end
  46. if tupe == "18" or tupe == "FAI" or tupe == "FAIRY" then attacktype = Fairy end
  47. if attacktype == nil then attacktype = None end
  48. end
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59. local connections = {}
  60. local debounce = {}
  61. for _, Part in pairs(Parts) do
  62. local connection = TOUCH_MANAGER.Touched(Part, function(hit)
  63. if hit then
  64. local Player = DamageService:GetPlayer(hit)
  65. if Player then
  66. if debounce[Player.Name] == nil then
  67. if DamageService:RegisterDamage(Handler, Player, Damage, attacktype) then
  68. debounce[Player.Name] = true
  69. if OnHitFunc then OnHitFunc(Player) end
  70. end
  71. end
  72. end
  73. end
  74. end)
  75. end
  76. local count = #Parts
  77. repeat
  78. wait(1)
  79. count = 0
  80. for _, Part in pairs(Parts) do
  81. if Part ~= nil then
  82. if Part.Parent ~= nil then
  83. count = count + 1
  84. end
  85. end
  86. end
  87. until count == 0
  88. for _, connection in pairs(connections) do
  89. connection:Disconnect()
  90. end
  91. end)
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement