Advertisement
SxScripting

AirCombat Local Script

Aug 21st, 2022
530
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. local UIS = game:GetService("UserInputService")
  2. local RS = game:GetService("ReplicatedStorage")
  3. local RunS = game:GetService("RunService")
  4. local Player = game.Players.LocalPlayer
  5. local CraterEffect = require(game.ReplicatedStorage.CraterModule)
  6.  
  7. local Character = Player.Character
  8.  
  9. local Space = false
  10. local LastHit = 0
  11. local ResetCooldown = 2
  12. local Event
  13.  
  14. local Distance = 4.5
  15.  
  16. function EnableJump()
  17. Character.Humanoid.JumpPower = 50
  18. end
  19.  
  20. function DisableJump()
  21. Character.Humanoid.JumpPower = 0
  22. end
  23.  
  24. UIS.InputBegan:Connect(function(Input, IsTyping)
  25. if IsTyping then return end
  26. if Input.UserInputType == Enum.UserInputType.MouseButton1 then
  27. local Eyes = Character.HumanoidRootPart.CFrame.LookVector
  28.  
  29. local RayCastPara = RaycastParams.new()
  30. RayCastPara.FilterDescendantsInstances = {Player.Character}
  31. RayCastPara.FilterType = Enum.RaycastFilterType.Blacklist
  32.  
  33. local RayHitBox = workspace:Raycast((Character.HumanoidRootPart.CFrame).p, Eyes * Distance, RayCastPara)
  34.  
  35. RS.CombatEvent:FireServer(RayHitBox and RayHitBox.Instance, Space)
  36.  
  37. DisableJump()
  38. LastHit = tick()
  39. Event = RunS.Heartbeat:Connect(function()
  40. if tick() - LastHit <= LastHit then return end
  41.  
  42. EnableJump()
  43. Event:Disconnect()
  44. Event = nil
  45. end)
  46. elseif Input.KeyCode == Enum.KeyCode.Space then
  47. Space = true
  48. end
  49. end)
  50.  
  51. UIS.InputEnded:Connect(function(Input)
  52. if Input.KeyCode == Enum.KeyCode.Space then
  53. Space = false
  54. end
  55. end)
  56.  
  57. RS.CombatEvent.OnClientEvent:Connect(function(Player,Value, TargetCFrame)
  58. EnableJump()
  59. if not Value or not TargetCFrame then return end
  60. if Value == "Downed" then
  61. task.wait(.2)
  62. CraterEffect.Create(8, (TargetCFrame).Position, 2)
  63. end
  64. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement