Why is my fov not really reverting?

Currently I am trying to create a Running script, or fix a previous one, and mostly the functionally actually works!

Then the FOV comes in. It seems as if prior I was trying to increase the fov for the duration of the player running, but it causes nothing, but issues it seems.

-- \\ Player-Related Variables //--

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local HUM = Character:WaitForChild("Humanoid")

local Humrp = Character:WaitForChild("HumanoidRootPart")



-- \\ Services // --

local UIS = game:GetService("UserInputService")

local TW = game:GetService("TweenService")

local CS = game:GetService("CollectionService")

local RF = game:GetService("ReplicatedFirst")

local Animation = script.RunAnim

-- \\ Misc. Variables // --

local camera = workspace.CurrentCamera

local Running = false

local duration = 0.1

local Animmm = HUM:WaitForChild("Animator"):LoadAnimation(Animation)

local LastTapped,Tapped = false,false

local lookVector = Humrp.CFrame.LookVector

local dashDirection = nil

local velocity = 14000 -- dash speed
-- \\ Functions // --

local CAM = TweenInfo.new(
	1, 
	Enum.EasingStyle.Back, 
	Enum.EasingDirection.Out, 
	1, 
	false,
	1
)

local RunITBACK = {
	FieldOfView = 70
}

local Pwehhh = {

	FieldOfView = 80

}

local FOV = TW:Create(camera, CAM, Pwehhh)

UIS.InputBegan:Connect(function(Input, Processed)

	if Processed then
		return
	end

	if Input.KeyCode == Enum.KeyCode.W then
		if Tapped == false then
			Tapped = true
		else
			LastTapped = true
			Tapped = false
			Animmm.Looped = true
			Running = true
			Animmm:Play()

			HUM.WalkSpeed = 22	
			FOV:Play()
		end



		delay(.4, function()
			if Tapped == true then
				FOV:Pause()
				Tapped = false
			end
		end)

	end
end)

UIS.InputEnded:Connect(function(Input, IsTyping)
	if IsTyping then return end
	if Input.KeyCode == Enum.KeyCode.W and LastTapped and not Tapped then
		Running = false
		if Running == false then
			HUM.WalkSpeed = 16
			Animmm:Stop()
			FOV:Cancel()
			TW:Create(camera, CAM, RunITBACK)
		end
		
	end
end)

Thankfully it’s a simpler script than the things I have been working on in the past few days, but I have always been iffy on anything related to tweens and animations.

1 Like

You create second tween for reset view but you doesnt use it (in input ended), and you play 2x FOV tween.

-- \\ Player-Related Variables //--

local Player = game.Players.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local HUM = Character:WaitForChild("Humanoid")

local Humrp = Character:WaitForChild("HumanoidRootPart")



-- \\ Services // --

local UIS = game:GetService("UserInputService")

local TW = game:GetService("TweenService")

local CS = game:GetService("CollectionService")

local RF = game:GetService("ReplicatedFirst")

local Animation = script.RunAnim

-- \\ Misc. Variables // --

local camera = workspace.CurrentCamera

local Running = false

local duration = 0.1

local Animmm = HUM:WaitForChild("Animator"):LoadAnimation(Animation)

local LastTapped,Tapped = false,false

local lookVector = Humrp.CFrame.LookVector

local dashDirection = nil

local velocity = 14000 -- dash speed
-- \\ Functions // --

local CAM = TweenInfo.new(
	1, 
	Enum.EasingStyle.Back, 
	Enum.EasingDirection.Out, 
	0, 
	false,
	1
)

local RunITBACK = {
	FieldOfView = 70
}

local Pwehhh = {

	FieldOfView = 80

}

local FOV1 = TW:Create(camera, CAM, Pwehhh)
local FOV2 = TW:Create(camera, CAM, RunITBACK)

UIS.InputBegan:Connect(function(Input, Processed)

	if Processed then
		return
	end

	if Input.KeyCode == Enum.KeyCode.W then
		if Tapped == false then
			Tapped = true
		else
			LastTapped = true
			Tapped = false
			Animmm.Looped = true
			Running = true
			Animmm:Play()

			HUM.WalkSpeed = 22	
			FOV1:Play()
		end



		delay(.4, function()
			if Tapped == true then
				FOV1:Pause()
				Tapped = false
			end
		end)

	end
end)

UIS.InputEnded:Connect(function(Input, IsTyping)
	if IsTyping then return end
	if Input.KeyCode == Enum.KeyCode.W and LastTapped and not Tapped then
		Running = false
		if Running == false then
			HUM.WalkSpeed = 16
			Animmm:Stop()
			FOV1:Cancel()
			FOV2:Play()
		end

	end
end)