Tween works weirdly

basically, the tween or camera instantly goes back to 70 or normal fov when the tweens ends, but what i’m trying to do is for as long as the key is held down (via the InputBegan) the longer the tween stays at its goal (80 fov) here is the script, (or most of it, i d’ont want people taking it):

--the tweens

local tweenInfoSprint = TweenInfo.new(
	.5, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.In, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

local SprintFOVTween = TweenService:Create(Camera, tweenInfoSprint, {FieldOfView = 80})

local tweenInfoSprintStop = TweenInfo.new(
	.5, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.In, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

--!!! removed some of the code because i dont want anyone to take it, (selfish, right?)

another non major but annoying error is that the second tween (the one that tweens back to 70) wont play

I would change

local tweenInfoSprintStop = TweenInfo.new(
	.5, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.In, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

to

local tweenInfoSprintStop = TweenInfo.new(
	.5, -- Time
	Enum.EasingStyle.Linear, -- EasingStyle
	Enum.EasingDirection.InOut, -- EasingDirection
	0, -- RepeatCount (when less than zero the tween will loop indefinitely)
	false, -- Reverses (tween will reverse once reaching it's goal)
	0 -- DelayTime
)

Do this with both of the tweenInfo.

Hope this fixes the issue!

1 Like

Maybe it is because you didn’t provide a KeyCode for the InputEnded event? Try:

userInputService.InputEnded:Connect(function(input)
  if input.KeyCode == Enum.KeyCode.LeftShift then
    -- do things
end)
1 Like

whoops my mistake, i forgot to revert that after screwing around with the script so this it what it actually was:

userInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		SprintStoppedFOVTween:Play()
		FullSprintAnim:Stop()
		hum.WalkSpeed = walkSpeed

		LightJogAnim:Stop()
		hum.WalkSpeed = walkSpeed
	end
end)

ill fix it right now, but no, that doesnt work

that just changes the easing style, so that has really nothing to do with the error

I’ve tested the script myself into an entirely empty game, it works perfectly and with no errors, the script you’re showing doesn’t have any sort of problem.

you should check some of your scripts that might be interfering with the FOV of the Camera.

2 Likes

i dont want to talk about it…

1 Like