Facebook
From AttackScript, 9 Months ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 162
  1. local rarm = script.Parent:FindFirstChild("RightHand")
  2. local larm = script.Parent:FindFirstChild("LeftHand")
  3. local sword = script.Parent:FindFirstChild("ClassicSword")
  4. local Attack_Speed = script.Parent.Parent:WaitForChild("AttackSpeed")
  5.  
  6. function dmg_hand(hit)
  7.  if hit.Parent ~= nil then
  8.   local hum = hit.Parent:FindFirstChild("Humanoid")
  9.   if hum ~= nil then
  10.    hum.Health = hum.Health - 1
  11.   end
  12.   wait(Attack_Speed.Value)
  13.  end
  14. end
  15.  
  16. function dmg_sword(hit)
  17.  if hit.Parent ~= nil then
  18.   local hum = hit.Parent:FindFirstChild("Humanoid")
  19.   if hum ~= nil then
  20.    hum.Health = hum.Health - 10
  21.   end
  22.   wait(Attack_Speed.Value)
  23.  end
  24. end
  25.  
  26. rarm.Touched:Connect(dmg_hand)
  27. larm.Touched:Connect(dmg_hand)
  28. sword.Touched:Connect(dmg_sword)
  29.