Rippermanayernerh

Lifesteal

Feb 8th, 2026
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. ["Punch"] = {
  2. ["Name"] = "Punch",
  3. ["Icon"] = "rbxassetid://93874368032471",
  4. ["LayoutOrder"] = 1,
  5. ["KeybindType"] = "MainAbility",
  6.  
  7. ["Cooldown"] = 1.25,--Cooldown
  8.  
  9. ["Callback"] = function(self, isLocal)
  10. -- LOCAL SIDE: play animation
  11. if isLocal then
  12. if self.Animations and self.Animations.Punch then
  13. self.Animations.Punch:Play(0.025)
  14. end
  15. return
  16. end
  17.  
  18. -- SERVER SIDE: do the hitbox
  19. if not game:GetService("RunService"):IsServer() then
  20. return
  21. end
  22.  
  23. -- Prevent ability spam
  24. if self.AbilitiesDisabled then
  25. return
  26. end
  27. self.AbilitiesDisabled = true
  28.  
  29. -- Create the actual hitbox
  30. local Hitboxes = require(game.ReplicatedStorage.Modules.Hitboxes)
  31.  
  32. Hitboxes:CreateHitbox(self.Player, {
  33. Size = Vector3.new(4, 5, 4),
  34. CFrameOffset = CFrame.new(0, 0, -2),
  35. Damage = self.Config.PunchDamage or 12,
  36. Time = 0.25,
  37. Knockback = 0.3,
  38. HitMultiple = false,
  39.  
  40. Connections = {
  41. Hit = function(victim)
  42. -- WHO WAS HIT
  43. local humVictim = victim:FindFirstChildOfClass("Humanoid")
  44. local humSelf = self.Rig and self.Rig:FindFirstChildOfClass("Humanoid")
  45.  
  46. if humVictim and humSelf then
  47.  
  48. -- === LIFE STEAL ===
  49. -- amount to steal from victim’s current health
  50. local lifestealPct = self.Config.PunchLifeStealPct or 0.25
  51. local lifestealAmt = humVictim.Health * lifestealPct
  52. humSelf.Health = math.min(humSelf.Health + lifestealAmt, humSelf.MaxHealth)
  53.  
  54. -- === MAX HEALTH STEAL ===
  55. -- optionally steal a % of the victim’s max health
  56. local stealMaxPct = self.Config.PunchMaxStealPct or 0.10
  57. local maxStealAmt = humVictim.MaxHealth * stealMaxPct
  58.  
  59. -- add max health to self
  60. humSelf.MaxHealth = humSelf.MaxHealth + maxStealAmt
  61. humSelf.Health = humSelf.Health + maxStealAmt
  62.  
  63. -- remove the max health stolen from the victim
  64. humVictim.MaxHealth = math.max(humVictim.MaxHealth - maxStealAmt, 1)
  65. humVictim.Health = math.min(humVictim.Health, humVictim.MaxHealth)
  66. end
  67. end
  68. }
  69. })
  70.  
  71. -- reset ability
  72. task.delay(self.Config.PunchCooldown or 1.25, function()
  73. self.AbilitiesDisabled = false
  74. end)
  75. end
  76. }
Advertisement
Add Comment
Please, Sign In to add comment