Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I stop CFrame:Lerp() from shaking my stand/HRP?

Asked by 3 years ago

I am trying to make a stand follow a player with a delay. I do not want to use welds (as they don't have a delay) and I do not want to use BodyPosition (the delay is too big). With CFrame:Lerp() I'm able to neatly control the movement delay of the stand. But whenever I move too fast, the stand starts shaking. I am not even sure if it's the speed that makes it shake, I need help.

Here's my code.

repeat wait() until game.Players.LocalPlayer.Character
local character = game.Players.LocalPlayer.Character

game:GetService("RunService").RenderStepped:Connect(function()
    for _,v in pairs(workspace.Stands:GetChildren()) do-----------v
        if v.User.Value ~= nil then-------------------------------Just finding the stand itself
            if v:FindFirstChild("HumanoidRootPart") ~= nil then---^
                local newCF = character.HumanoidRootPart.CFrame*CFrame.new(2,2,3)--The new CFrame to which I lerp to
                v.HumanoidRootPart.CFrame = v.HumanoidRootPart.CFrame:Lerp(newCF,0.1)--Lerp
            end
        end
    end
end)

How do I stop CFrame:Lerp() from shaking my stand/HRP? (HRP-HumanoidRootPart)

Answer this question