How do I move the camera smoother?

When this script is activated the camera moves down slow and not very smooth. Is there a better way to do it and get smoother camera movement?

wait()
Character = game.Players.LocalPlayer.Character

Humanoid = Character.Humanoid

Animation = script.Anim

AnimationTrack = Character.Humanoid:LoadAnimation(Animation)

game:GetService("UserInputService").InputBegan:connect(function(input)
    if input.KeyCode == Enum.KeyCode.C then -- This detects if "e" is pressed
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.1, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.2, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.3, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.4, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.5, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.6, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.7, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.8, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.9, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -1, 0)
        Character.Humanoid.WalkSpeed = 0
		AnimationTrack:Play()
    end 
end) 
game:GetService("UserInputService").InputEnded:connect(function(input)
	if input.KeyCode == Enum.KeyCode.C then --this detects if "e" is not pressed
		Humanoid.CameraOffset = Vector3.new(0, -1, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.9, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.8, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.7, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.6, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.5, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.4, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.3, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.2, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, -0.1, 0)
		wait(1)
		Humanoid.CameraOffset = Vector3.new(0, 0, 0)
 		Character.Humanoid.WalkSpeed = 10
		AnimationTrack:Stop()
	end
end)
2 Likes

i tell you just to replace those Vector3.new() into CFrame.new()

Have you looked into Tweening?

Tweening smoothy interpolates between values so you don’t have to do it manually and it looks a lot smoother and better with a tween rather than doing it manually.

2 Likes

Your Code is unnecessarily long. Try using TweenService

Also put your code in code block so like this:
```
Code Here
```

You should use a for loop it will make the code easier (this has nothing to do with making the camera smoother it’s just a suggestion)

That’s won’t work since the CameraOffset property is a Vector3

well he can just get his Current Camera which is in workspace and use this function

Cam:Interpolate()

Its like camera manipulation

but smooth too

Interpolate is deprecated and you should use TweenService instead

No, no, no! Use TweenService instead. It is 100% smooth.

You need to use TweenService