local UserInputService = game:GetService('UserInputService')
local player = game.Players.LocalPlayer
local SPRINT_WALKSPEED = 32
local CAMERA_SPRINT_FOV = 90
local NORMAL_CAMERA_FOV = 70
local NORMAL_WALK = 16
local tweenDelay = 1.2
local toggle = false
local camera = workspace.CurrentCamera
local lastW = tick()
local DELTA_W_THRESHOLD = .2
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(tweenDelay, Enum.EasingStyle.Sine)
local sprintFovTween = tweenService:Create(camera, tweenInfo, { FieldOfView = CAMERA_SPRINT_FOV })
local normalFovTween = tweenService:Create(camera, tweenInfo, { FieldOfView = NORMAL_CAMERA_FOV })
UserInputService.InputBegan:Connect(function(inputObject)
local timeSinceLetGoOfW = tick() - lastW
if inputObject.KeyCode == Enum.KeyCode.W and timeSinceLetGoOfW <= DELTA_W_THRESHOLD then
player.Character.Humanoid.WalkSpeed = SPRINT_WALKSPEED
sprintFovTween:Play()
end
end)
UserInputService.InputEnded:Connect(function( inputObject)
if inputObject.KeyCode == Enum.KeyCode.W then
lastW = tick()
player.Character.Humanoid.WalkSpeed = NORMAL_WALK
normalFovTween:Play()
end
end)