Hasli4

RBLX. NPCAttack

Jan 9th, 2026
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local rarm = script.Parent:FindFirstChild("RightHand")
  2.  
  3. local larm = script.Parent:FindFirstChild("LeftHand")
  4.  
  5. local sword = script.Parent:FindFirstChild("ClassicSword")
  6.  
  7. local Attack_Speed = script.Parent.Parent.AttackSpeed
  8.  
  9. function dmg_hand(hit)
  10.  
  11.         if hit.Parent ~= nil then
  12.  
  13.                 local hum = hit.Parent:findFirstChild("Humanoid")
  14.  
  15.                 if hum ~= nil then
  16.  
  17.                         hum.Health = hum.Health - 0.1
  18.  
  19.                 end
  20.  
  21.                 wait(Attack_Speed.Value)
  22.  
  23.         end
  24.  
  25. end
  26.  
  27. function dmg_sword(hit)
  28.  
  29.         if hit.Parent ~= nil then
  30.  
  31.                 local hum = hit.Parent:findFirstChild("Humanoid")
  32.  
  33.                 if hum ~= nil then
  34.  
  35.                         hum.Health = hum.Health - 1
  36.  
  37.                 end
  38.  
  39.                 wait(Attack_Speed.Value)
  40.  
  41.         end
  42.  
  43. end
  44.  
  45. rarm.Touched:connect(dmg_hand)
  46.  
  47. larm.Touched:connect(dmg_hand)
  48.  
  49. sword.Touched:connect(dmg_sword)
Advertisement
Add Comment
Please, Sign In to add comment