Guest User

Kil

a guest
Jun 25th, 2020
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.75 KB | None | 0 0
  1. local combo = 0
  2. local timetoattack = .8
  3. local dmg = 6
  4. local range = 7
  5.  
  6. script.Parent.OnServerEvent:Connect(function (plr, EnemBlocking)
  7.    
  8.     local Character = plr.Character
  9.     local Humanoid = Character.Humanoid
  10.    
  11.     combo = combo + 1
  12.    
  13.     local leftpunch = Humanoid:LoadAnimation(script.leftpunch)
  14.     local rightpunch = Humanoid:LoadAnimation(script.rightpunch)
  15.     local leftuppercut = Humanoid:LoadAnimation(script.leftuppercut)
  16.     local rightuppercut = Humanoid:LoadAnimation(script.leftuppercut)
  17.    
  18.     for i, v in pairs(game.Workspace:GetChildren()) do
  19.                 local m = (v: IsA("Model") and v) or nil
  20.         if m and m:FindFirstChild("Humanoid") and m:FindFirstChild("HumanoidRootPart") and m ~= Character then
  21.                 if (Character.HumanoidRootPart.Position - m.HumanoidRootPart.Position).magnitude <= range then
  22.    
  23.             if combo == 1 or combo == 2 or combo == 3 or combo == 4 or combo == 5 then
  24.                 m.Humanoid:TakeDamage(dmg)
  25.             end
  26.            
  27.             if combo == 1 then
  28.                 local punched1 = script.punched1:Clone()
  29.                 punched1.Parent = m.Head
  30.                 punched1:Play()
  31.                 game.Debris:addItem(punched1,.4)
  32.                 v.Humanoid:LoadAnimation(script.punchedright):Play()
  33.                 end
  34.                
  35.             if combo == 2 then
  36.                 local punched2 = script.punched2:Clone()
  37.                 punched2.Parent = m.Head
  38.                 punched2:Play()
  39.                 game.Debris:addItem(punched2,.4)
  40.                 m.Humanoid:LoadAnimation(script.punchedleft):Play()
  41.                 end
  42.                
  43.             if combo == 3 then
  44.                 local punched3 = script.punched3:Clone()
  45.                 punched3.Parent = m.Head
  46.                 punched3:Play()
  47.                 game.Debris:AddItem(punched3,.4)
  48.                 m.Humanoid:LoadAnimation(script.rightuppercutface):Play()
  49.                 end
  50.                
  51.             if combo == 4 then
  52.                 local punched4 = script.punched4:Clone()
  53.                 punched4.Parent = m.Head
  54.                 punched4:Play()
  55.                 game.Debris:AddItem(punched4,.4)
  56.                 m.Humanoid:LoadAnimation(script.leftuppercutpunched):Play()
  57.             end
  58.                
  59.                
  60.         end
  61.     end
  62. end
  63.  
  64. if combo == 1 then
  65.         local leftpunch = Humanoid:LoadAnimation(script.leftpunch):Play()
  66.         print ("p1")
  67.  
  68.    
  69. else if combo == 2 then
  70.         local rightpunch = Humanoid:LoadAnimation(script.rightpunch):Play()
  71.         print ("p2")
  72.        
  73.        
  74.         spawn (function()
  75.             wait(timetoattack)
  76.             if combo == 2 then
  77.                 combo = 0
  78.             end
  79.         end)
  80.        
  81. else if combo == 3 then
  82.         local leftuppercut = Humanoid:LoadAnimation(script.leftuppercut):Play()
  83.         print ("p3")
  84.    
  85.            
  86.         spawn(function()
  87.             wait(timetoattack)
  88.             if combo == 3 then
  89.                 combo = 0
  90.                 end
  91.             end)
  92.            
  93. else if combo == 4 then
  94.         local rightuppercut = Humanoid:LoadAnimation(script.rightuppercut):Play()
  95.         print ("p4")
  96.  
  97.                
  98.         spawn(function()
  99.         wait(timetoattack)
  100.         if combo == 4 then
  101.             combo = 0
  102.     end
  103. end)
  104.                    
  105.                    
  106. combo = 100
  107. wait(2)
  108. combo = 0
  109.                
  110.             end    
  111.         end
  112.     end
  113. end
  114.      
  115. end)
Advertisement
Add Comment
Please, Sign In to add comment