LUA   254

Roblox Melee Weapon Script

Guest on 20th April 2022 08:52:17 PM

  1. local tool = script.Parent
  2. local canDamage = false
  3.  
  4. local function onTouch(otherPart)
  5.  
  6.     local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
  7.  
  8.     if not humanoid then
  9.         return
  10.     end
  11.  
  12.     if humanoid.Parent ~= tool.Parent and canDamage then
  13.         humanoid:TakeDamage(5)
  14.     else
  15.         return
  16.     end
  17.  
  18.     canDamage = false
  19. end
  20.  
  21. local function slash()
  22.     local str = Instance.new("StringValue")
  23.     str.Name = "toolanim"
  24.     str.Value = "Slash"
  25.     str.Parent = tool
  26.     canDamage = true
  27. end
  28.  
  29. tool.Activated:Connect(slash)
  30. tool.Handle.Touched:Connect(onTouch)

Raw Paste


Login or Register to edit or fork this paste. It's free.