Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------
- local InputService = game:GetService("UserInputService")
- local RepStorage = game:GetService('ReplicatedStorage')
- local CombatModule = RepStorage:WaitForChild('CONSTRUCTOR_CombatSystem')
- print('ABC')
- -- Click timing
- local interval = 0.5
- local timestamp = tick()
- -- Getting Player's Character
- local player = game.Players.LocalPlayer
- local Character = player.Character or player.CharacterAdded:Wait()
- local humanoid = Character:WaitForChild('Humanoid')
- local LeftFoot = player.Character:WaitForChild("LeftFoot")
- local RightFoot = player.Character:WaitForChild("RightFoot")
- -- Getting other things we need
- local Camera = game.Workspace.CurrentCamera
- local Debris = game:GetService("Debris")
- local SpeedBoost = 20 - 10
- local DefaultSpeed = 10
- local DefaultFov = 70
- local playerCombatInfo
- local lastSpeed = 0
- local running = false
- local keysPressing = {}
- -- Key that will activate the double press function
- local doubleClickKey = Enum.KeyCode.W
- local TweenService = game:GetService("TweenService")
- local RunAnim = humanoid:LoadAnimation(script:WaitForChild("RunAnim"))
- local WalkAnim = humanoid:LoadAnimation(script:WaitForChild('WalkAnim'))
- local JumpAnim = humanoid:LoadAnimation(script:WaitForChild('JumpAnim'))
- local IdleAnim = humanoid:LoadAnimation(script:WaitForChild('IdleAnim'))
- humanoid.Died:Connect(function()
- RunAnim:Stop()
- WalkAnim:Stop()
- JumpAnim:Stop()
- IdleAnim:Stop()
- end)
- local function doublePress()
- Character.Humanoid.WalkSpeed = Character.Humanoid.WalkSpeed + SpeedBoost
- local goal = {}
- running = true
- goal.FieldOfView = Camera.FieldOfView + 10
- local info = TweenInfo.new(1)
- local tween = TweenService:Create(Camera,info,goal)
- tween:Play()
- end
- -- Function for when one press occurs
- local function onePress()
- Character.Humanoid.WalkSpeed = math.clamp(Character.Humanoid.WalkSpeed - SpeedBoost,0,50)
- local goal = {}
- running = false
- goal.FieldOfView = DefaultFov
- local info = TweenInfo.new(1)
- local tween = TweenService:Create(Camera,info,goal)
- tween:Play()
- end
- InputService.InputBegan:Connect(function(input, processed)
- if not processed then
- keysPressing[Enum.KeyCode.W] = true
- if input.KeyCode == doubleClickKey then
- if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
- if tick() - timestamp <= interval and playerCombatInfo.IsBlocking == false and humanoid.WalkSpeed ~= 0 and not playerCombatInfo.IsBlocking then
- doublePress()
- else
- timestamp = tick()
- end
- elseif input.KeyCode == Enum.KeyCode.F then
- running = false
- humanoid.WalkSpeed = 6
- elseif input.KeyCode == Enum.KeyCode.One then
- if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
- if playerCombatInfo.Holding then
- IdleAnim:Stop()
- end
- end
- end
- end)
- InputService.InputEnded:Connect(function(input,processed)
- if not processed then
- keysPressing[input.KeyCode] = nil
- if input.KeyCode == doubleClickKey and running then
- onePress()
- elseif input.KeyCode == Enum.KeyCode.F then
- humanoid.WalkSpeed = 10
- end
- end
- end)
- humanoid.Running:Connect(function()
- if not playerCombatInfo then playerCombatInfo = require(CombatModule).getPlayerCombatInfo(player) end
- if humanoid.MoveDirection.Magnitude <= 0 then
- if RunAnim.IsPlaying then RunAnim:Stop()
- elseif WalkAnim.IsPlaying then WalkAnim:Stop() end
- if not playerCombatInfo.Holding then
- IdleAnim:Play()
- end
- return
- end
- local speed = humanoid.WalkSpeed
- if speed < 20 and not WalkAnim.IsPlaying then
- WalkAnim:Play()
- IdleAnim:Stop()
- elseif speed >= 20 and not RunAnim.IsPlaying then
- RunAnim:Play()
- IdleAnim:Stop()
- end
- lastSpeed = speed
- end)
- humanoid.Jumping:Connect(function(isActive)
- JumpAnim:Play()
- IdleAnim:Stop()
- wait(0.4)
- JumpAnim:Stop()
- end)
- humanoid:GetPropertyChangedSignal('WalkSpeed'):Connect(function()
- local walkspeed = humanoid.WalkSpeed
- if walkspeed == 0 then
- running = false
- onePress()
- elseif walkspeed < 20 then
- RunAnim:Stop()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement