Ad
Log in to vote
0

How can I stop the camera from shaking when I tween the HRP?

Asked by 6 days ago

Basically, I'm making a system where you click and it moves you forward. I tweened the HRP forward, but when the tween plays it shakes the camera. I don't want there to be camera shake at all, it looks like it's lagging whenever the camera jitters when you tween the HRP. Somebody suggested anchoring the HRP, but the problem is still there. Here is the script I wrote for it:

local ts = game:GetService("TweenService")
local uis = game:GetService("UserInputService")

local plr = game.Players.LocalPlayer

repeat wait() until plr.Character
repeat wait() until plr.Character.HumanoidRootPart

local hrp = plr.Character.HumanoidRootPart
local info = TweenInfo.new(
    0.4,
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false
)
uis.InputBegan:Connect(function(input, gpe)
    if gpe then return end

    local destination = hrp.CFrame * CFrame.new(0,0,-10)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        local tween = ts:Create(hrp, info, {CFrame = destination})
        tween:Play()

    end
end)

Any ideas on how to stop the camera from jittering?

Answer this question