How can I smoothly make camera offset

I’ve got code to make the characters camera move down but like it happens instant and idk how to make it smooth I’ve done it before but forgot how

game.Workspace[localPlayer.Name].Humanoid.CameraOffset = game.Workspace[localPlayer.Name].Humanoid.CameraOffset:lerp(Vector3.new(0,-2,0), .10)
1 Like

Hey @Ie_fishe, first of all l hate your name :slight_smile:

Okay so what you’re looking for is a Tween!

So here’s what that code looks like:

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local TweenService = game:GetService("TweenService")

function ChangeCameraOffset(Offset) -- [Vector3]Offset
    if not Character then Character = Player.Character or Player.CharacterAdded:Wait() end
    local Humanoid = Character:WaitForChild("Humanoid")
    
    local Tween = TweenService:Create(Humanoid, TweenInfo.new(0.1), {CameraOffset = Offset})
    Tween:Play()
end

ChangeCameraOffset(Vector3.new(0, -2, 0))

Hope this helps!

11 Likes

What do I put in for Camera offset? And what do I put in for = Offset?