Advertisement
SxScripting

Combat Server Script [New]

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