Advertisement
HowToRoblox

CombatClient

Jul 23rd, 2021
6,766
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.95 KB | None | 0 0
  1. local uis = game:GetService("UserInputService")
  2.  
  3.  
  4. local combo = {game.ReplicatedStorage.CombatAnimations:WaitForChild("RPunch"),
  5.                game.ReplicatedStorage.CombatAnimations:WaitForChild("LPunch"),
  6.                game.ReplicatedStorage.CombatAnimations:WaitForChild("RHook")}
  7.  
  8. local nextCombo = 1
  9.  
  10. local attacking = false
  11.  
  12.  
  13.  
  14. uis.InputBegan:Connect(function(inp, processed)
  15.    
  16.    
  17.     if attacking or processed then return end
  18.    
  19.    
  20.     if inp.KeyCode == Enum.KeyCode.F then
  21.        
  22.        
  23.         attacking = true   
  24.        
  25.        
  26.         if nextCombo > #combo then
  27.             nextCombo = 1
  28.         end
  29.  
  30.        
  31.         local currentAttack = nextCombo
  32.        
  33.         nextCombo += 1
  34.        
  35.        
  36.         local loadedAnim = script.Parent.Humanoid:LoadAnimation(combo[currentAttack])
  37.        
  38.         loadedAnim:Play()
  39.        
  40.         loadedAnim.Stopped:Wait()
  41.        
  42.        
  43.         if nextCombo > 3 then
  44.             wait(0.2)
  45.         end
  46.        
  47.        
  48.         attacking = false
  49.        
  50.         wait(2)
  51.        
  52.        
  53.         if nextCombo == currentAttack + 1 then
  54.            
  55.             nextCombo = 1
  56.         end
  57.     end
  58. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement