You are on page 1of 1

local CAS = game:GetService("ContextActionService")

local UIS = game:GetService("UserInputService")


local jumpDisabled = false

local player = game.Players.LocalPlayer


local char = player.Character or player.CharacterAdded:wait()
local hum = char:WaitForChild("Humanoid")

local run_Anim = hum:LoadAnimation(script:WaitForChild("ExportAnim"))

function onJump()
if jumpDisabled then
hum.Jump = false
end
end

function toggleSprint(actionName, inputState, inputObject)


if inputState == Enum.UserInputState.Begin then
hum:LoadAnimation(script:WaitForChild("ExportAnim")):Play()
hum.WalkSpeed = 35
jumpDisabled = true
elseif inputState == Enum.UserInputState.End then
hum:LoadAnimation(script:WaitForChild("ExportAnim")):Stop()
hum.WalkSpeed = 16
jumpDisabled = false
hum:LoadAnimation(script:WaitForChild("WalkAnim")):Play()
end
end

function windowFocused()
hum:LoadAnimation(script:WaitForChild("ExportAnim")):Stop()
hum.WalkSpeed = 18
jumpDisabled = false
end

CAS:BindAction("toggleSprint", toggleSprint, false, Enum.KeyCode.LeftShift)


UIS.WindowFocused:connect(windowFocused)
hum.Changed:connect(onJump)

You might also like