Advertisement
DanielSiqueira

AAAAA

Jan 25th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. ---------------
  2. local InputService = game:GetService("UserInputService")
  3. local RepStorage = game:GetService('ReplicatedStorage')
  4. local CombatModule = RepStorage:WaitForChild('CONSTRUCTOR_CombatSystem')
  5. print('ABC')
  6. -- Click timing
  7. local interval = 0.5
  8. local timestamp = tick()
  9.  
  10. -- Getting Player's Character
  11. local player = game.Players.LocalPlayer
  12. local Character = player.Character or player.CharacterAdded:Wait()
  13. local humanoid = Character:WaitForChild('Humanoid')
  14. local LeftFoot = player.Character:WaitForChild("LeftFoot")
  15. local RightFoot = player.Character:WaitForChild("RightFoot")
  16.  
  17. -- Getting other things we need
  18. local Camera = game.Workspace.CurrentCamera
  19. local Debris = game:GetService("Debris")
  20. local SpeedBoost = 20 - 10
  21. local DefaultSpeed = 10
  22. local DefaultFov = 70
  23.  
  24. local playerCombatInfo
  25.  
  26. local lastSpeed = 0
  27. local running = false
  28. local keysPressing = {}
  29.  
  30. -- Key that will activate the double press function
  31. local doubleClickKey = Enum.KeyCode.W
  32.  
  33. local TweenService = game:GetService("TweenService")
  34. local RunAnim = humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
  35. local WalkAnim = humanoid:LoadAnimation(script:WaitForChild('WalkAnim'))
  36. local JumpAnim = humanoid:LoadAnimation(script:WaitForChild('JumpAnim'))
  37. local IdleAnim = humanoid:LoadAnimation(script:WaitForChild('IdleAnim'))
  38.  
  39. humanoid.Died:Connect(function()
  40.  
  41. RunAnim:Stop()
  42. WalkAnim:Stop()
  43. JumpAnim:Stop()
  44. IdleAnim:Stop()
  45.  
  46. end)
  47.  
  48.  
  49. local function doublePress()
  50.  
  51. Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed + SpeedBoost
  52. local goal = {}
  53. running = true
  54. goal.FieldOfView = Camera.FieldOfView + 10
  55. local info = TweenInfo.new(1)
  56. local tween = TweenService:Create(Camera,info,goal)
  57. tween:Play()
  58.  
  59. end
  60.  
  61.  
  62. -- Function for when one press occurs
  63.  
  64. local function onePress()
  65.  
  66. Character.Humanoid.WalkSpeed = math.clamp(Character.Humanoid.WalkSpeed - SpeedBoost,0,50)
  67. local goal = {}
  68. running = false
  69. goal.FieldOfView = DefaultFov
  70. local info = TweenInfo.new(1)
  71. local tween = TweenService:Create(Camera,info,goal)
  72. tween:Play()
  73.  
  74. end
  75.  
  76.  
  77. InputService.InputBegan:Connect(function(input, processed)
  78. if not processed then
  79. keysPressing[Enum.KeyCode.W] = true
  80. if input.KeyCode == doubleClickKey then
  81. if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
  82. if tick() - timestamp <= interval and playerCombatInfo.IsBlocking == false and humanoid.WalkSpeed ~= 0 and not playerCombatInfo.IsBlocking then
  83. doublePress()
  84. else
  85. timestamp = tick()
  86. end
  87. elseif input.KeyCode == Enum.KeyCode.F then
  88. running = false
  89. humanoid.WalkSpeed = 6
  90. elseif input.KeyCode == Enum.KeyCode.One then
  91. if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
  92. if playerCombatInfo.Holding then
  93. IdleAnim:Stop()
  94. end
  95. end
  96. end
  97. end)
  98.  
  99. InputService.InputEnded:Connect(function(input,processed)
  100.  
  101. if not processed then
  102. keysPressing[input.KeyCode] = nil
  103. if input.KeyCode == doubleClickKey and running then
  104. onePress()
  105. elseif input.KeyCode == Enum.KeyCode.F then
  106. humanoid.WalkSpeed = 10
  107. end
  108. end
  109.  
  110. end)
  111.  
  112. humanoid.Running:Connect(function()
  113. if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
  114. if humanoid.MoveDirection.Magnitude <= 0 then
  115. if RunAnim.IsPlaying then RunAnim:Stop()
  116. elseif WalkAnim.IsPlaying then WalkAnim:Stop() end
  117. if not playerCombatInfo.Holding then
  118. IdleAnim:Play()
  119. end
  120. return
  121. end
  122. local speed = humanoid.WalkSpeed
  123. if speed < 20 and not WalkAnim.IsPlaying then
  124. WalkAnim:Play()
  125. IdleAnim:Stop()
  126. elseif speed >= 20 and not RunAnim.IsPlaying then
  127. RunAnim:Play()
  128. IdleAnim:Stop()
  129. end
  130. lastSpeed = speed
  131. end)
  132.  
  133. humanoid.Jumping:Connect(function(isActive)
  134. JumpAnim:Play()
  135. IdleAnim:Stop()
  136. wait(0.4)
  137. JumpAnim:Stop()
  138. end)
  139.  
  140. humanoid:GetPropertyChangedSignal('WalkSpeed'):Connect(function()
  141.  
  142. local walkspeed = humanoid.WalkSpeed
  143. if walkspeed == 0 then
  144. running = false
  145. onePress()
  146. elseif walkspeed < 20 then
  147. RunAnim:Stop()
  148. end
  149.  
  150. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement