I have a running script on the client and it seems when I press the shift button/keybind to active running while holding it down it does not play. I am so confused to why it does not play as no errors show up aswell as I have used the script previously for another projected and it works there perfectly.
local UserInputService = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")
local ContextActionService = game:GetService("ContextActionService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animateScript = script.Parent:WaitForChild("Animate")
local runAnimation = humanoid:LoadAnimation(animateScript:WaitForChild("run").Running)
local playerStuff = script.Parent:WaitForChild("PlayerStuff")
local isRunningValue = playerStuff:WaitForChild("Running")
local camera = workspace.CurrentCamera
local fovRunTween = TweenService:Create(camera, TweenInfo.new(0.5), {FieldOfView = 75})
local fovWalkTween = TweenService:Create(camera, TweenInfo.new(0.5), {FieldOfView = 70})
local isMoving = false
local isSprinting = false
humanoid.Running:Connect(function(speed)
if speed == 0 and isMoving and isSprinting then
isMoving = false
isRunningValue.Value = false
runAnimation:Stop()
fovWalkTween:Play()
elseif speed > 0 and isSprinting and not isMoving then
isMoving = true
isRunningValue.Value = true
fovRunTween:Play()
runAnimation:Play()
end
end)
ContextActionService:BindAction(
"Sprint",
function(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
isSprinting = true
fovRunTween:Play()
humanoid.WalkSpeed = 24
else
isSprinting = false
isMoving = false
runAnimation:Stop()
fovWalkTween:Play()
humanoid.WalkSpeed = 16
end
end,
true,
Enum.KeyCode.LeftShift,
Enum.KeyCode.ButtonR1
)
ContextActionService:SetTitle("Sprint", "RUN")
