Advertisement
SxScripting

Updated Combat System [2021]

Jan 17th, 2021
5,545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.41 KB | None | 0 0
  1. -- Don't Forget to Subscribe! : )
  2.  
  3. local RS = game:GetService("ReplicatedStorage")
  4. local Debounce = {}
  5. local Combo = {}
  6.  
  7. RS.Event.OnServerEvent:Connect(function(Player)
  8. if Player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Freefall then return end
  9.  
  10. for i,v in pairs(Player.Character:GetChildren()) do -- [0 Added]
  11. if v:IsA("Tool") then return v end
  12. end
  13.  
  14. if Debounce[Player] then return end
  15. Debounce[Player] = true
  16.  
  17. if not Combo[Player] then Combo[Player] = 0 end
  18.  
  19. local Character = Player.Character
  20. local Humanoid = Character.Humanoid
  21.  
  22. local Strength = Player:WaitForChild("PowerFolder").Strength.Value -- [1 Added]
  23.  
  24. Combo[Player] += 1
  25.  
  26. local Hit1 = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Hit1)
  27. local Hit2 = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Hit2)
  28. local Hit3 = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Hit3)
  29. local Hit4 = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Hit4)
  30. local Hit5 = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations.Hit5)
  31.  
  32. local v1 = {}
  33. local Eyes = Character.HumanoidRootPart.CFrame.LookVector
  34. local Distance = 4.5
  35. local GeneralWaitTIme = .4
  36. local OverallWait = 2.1
  37.  
  38. local RayCastPara = RaycastParams.new()
  39. RayCastPara.FilterDescendantsInstances = {Player.Character}
  40. RayCastPara.FilterType = Enum.RaycastFilterType.Blacklist
  41.  
  42. local RayHitBox = workspace:Raycast((Character.HumanoidRootPart.CFrame).p, Eyes * Distance, RayCastPara)
  43.  
  44. local function Speed()
  45. RayHitBox.Instance.Parent:FindFirstChild("Humanoid").WalkSpeed = 0
  46. RayHitBox.Instance.Parent:FindFirstChild("Humanoid").JumpPower = 0
  47. end
  48.  
  49. local function Hitbox()
  50. if RayHitBox then
  51. if RayHitBox.Instance and RayHitBox.Instance.Parent:FindFirstChild("Humanoid") then
  52. if Combo[Player] == 5 then
  53. local BV = Instance.new("BodyVelocity",RayHitBox.Instance.Parent:FindFirstChild("HumanoidRootPart"))
  54. BV.MaxForce = Vector3.new(math.huge,0,math.huge)
  55. BV.Velocity = Player.Character.HumanoidRootPart.CFrame.LookVector * 40
  56. RayHitBox.Instance.Parent.Humanoid:TakeDamage(5 + Strength - game.Players:GetPlayerFromCharacter(RayHitBox.Instance.Parent):FindFirstChild("PowerFolder").Defense.Value/1.5)
  57. game.Debris:AddItem(BV,.5)
  58. Speed()
  59. else
  60. table.insert(v1, RayHitBox.Instance.Parent.Humanoid)
  61. v1[1]:TakeDamage(5 + Strength - game.Players:GetPlayerFromCharacter(RayHitBox.Instance.Parent):FindFirstChild("PowerFolder").Defense.Value/1.5)
  62. Speed()
  63. end
  64. end
  65. end
  66. end
  67.  
  68. if Combo[Player] == 1 then
  69. Hit1:Play()
  70. Hitbox()
  71. wait(GeneralWaitTIme)
  72. end
  73.  
  74. if Combo[Player] == 2 then
  75. Hit2:Play()
  76. Hitbox()
  77. wait(GeneralWaitTIme)
  78. end
  79.  
  80. if Combo[Player] == 3 then
  81. Hit3:Play()
  82. Hitbox()
  83. wait(GeneralWaitTIme)
  84. end
  85.  
  86. if Combo[Player] == 4 then
  87. Hit4:Play()
  88. Hitbox()
  89. wait(GeneralWaitTIme)
  90. end
  91.  
  92. if Combo[Player] == 5 then
  93. Hit5:Play()
  94. Hitbox()
  95. wait(OverallWait)
  96. Combo[Player] = 0
  97. end
  98.  
  99.  
  100. delay(.4,function()
  101. if RayHitBox then
  102. if RayHitBox.Instance.Parent:FindFirstChild("Humanoid") and v1[1] == nil then
  103. if Combo[Player] then
  104. print(Combo[Player])
  105. RayHitBox.Instance.Parent:FindFirstChild("Humanoid").WalkSpeed = 16
  106. RayHitBox.Instance.Parent:FindFirstChild("Humanoid").JumpPower = 50
  107. end
  108. end
  109. else
  110. print("Not Found")
  111. end
  112. end)
  113.  
  114. table.remove(v1, 1)
  115. Debounce[Player] = nil
  116. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement