Fov run bug script

im having this issue with this script when you spam shift it distorts your fov and your walkspeed and I don’t know how to fix this error.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local animation = nil

local camera = game.Workspace.CurrentCamera



local UIS = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local RS = game:GetService("RunService")


local IsRunning = script:WaitForChild("AnimStopped")
--
local Configuration = require(game.ReplicatedStorage.Modules:WaitForChild("Configuration"))

function IsWalking()
	if humanoid.MoveDirection.Magnitude > 0 then
		return true
	else
		return false
	end
end

UIS.InputBegan:Connect(function(key, proccess)
	if key.KeyCode == Configuration.RunKey then
		if IsWalking() then
			animation = humanoid:LoadAnimation(script.Animation)
			IsRunning = true -- set this to true when key is pressed
			humanoid.JumpPower = 0
			humanoid.WalkSpeed = humanoid.WalkSpeed + 9
			TweenService:Create(camera, TweenInfo.new(0.2, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {FieldOfView = camera.FieldOfView + 10}):Play()
		end
	end
end)


UIS.InputEnded:Connect(function(key, proccess)
	if key.KeyCode == Configuration.RunKey then
		IsRunning = false 
		humanoid.JumpPower = 50
		humanoid.WalkSpeed = humanoid.WalkSpeed - 9
		TweenService:Create(camera, TweenInfo.new(0.2 , Enum.EasingStyle.Linear, Enum.EasingDirection.InOut), {FieldOfView = camera.FieldOfView - 10}):Play()
	end
end)


RS.Heartbeat:Connect(function()
	if IsRunning and IsWalking() then
		if animation and not animation.IsPlaying then 
			animation:Play(0.1,1,2)
		end
	else 
		if animation and animation.IsPlaying then
			animation:Stop()
		end
	end
end)

Just have a Set Value you want the FOV to Tween Towards, if you spam it, it will most likely subtract more than what you Intend it to, so for this case if you have 70 as your FOV, change it to 80, then back to 70

{FieldOfView = 80}
{FieldOfView = 70}

Also:

return (humanoid.MoveDirection.Magnitude > 0) -- should return a Boolean still

hey its because i have a tool that will extend your fov so i wouldnt want it to reset its fov