Advertisement
HowToRoblox

DamageScriptKillsLB

Dec 11th, 2019
11,856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. script.Parent.Blade.Touched:Connect(function(touch)
  2.  
  3.     if script.Parent.CanDamage.Value == true then
  4.  
  5.         local humanoid = touch.Parent:FindFirstChild("Humanoid")
  6.  
  7.         if not touch.Parent:FindFirstChild("Humanoid") then
  8.  
  9.             humanoid = touch.Parent.Parent:FindFirstChild("Humanoid")
  10.  
  11.         end
  12.  
  13.         if humanoid.Name ~= "Humanoid" then return end
  14.        
  15.         script.Parent.CanDamage.Value = false
  16.  
  17.         humanoid:TakeDamage(20)
  18.        
  19.         if humanoid.Health < 1 then
  20.            
  21.             local plr = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
  22.             plr.leaderstats.Kills.Value = plr.leaderstats.Kills.Value + 1
  23.            
  24.         end
  25.        
  26.         wait(1)
  27.        
  28.         script.Parent.CanDamage.Value = true
  29.     end
  30. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement