I want to know how to make the cframe not stutter. Basically whenever I start moving, the part starts stuttering behind me, I believe its because the lerps “goal” is always changing whenever im moving causing it to stutter.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Rs = game:GetService("RunService")
local Test = workspace:WaitForChild("TestPart")
function Follow(Dt)
local st = (Dt * 60)
Test.CFrame = Test.CFrame:Lerp(Character.PrimaryPart.CFrame, math.clamp(0.1 * st, 0, 1))
end
Rs:BindToRenderStep("Test", Enum.RenderPriority.Last.Value, Follow)
I believe the RenderPriority changes the order of when the function is run each frame (for example, Camera + 1 is after the camera updates and Camera - 1 is before the camera updates). I think worst case using a later priority could only cause it to be one frame behind, though I don’t think it would be choppy like in the video.
Reason why you’re getting CFrame stutters is because your DT is not constant in your Lerp factor. math.clamp(0.1 * (Dt * 60))
Basically the Speed is unpredictable. Which starts to stutter a lot. I recommend using Align Position and Orientation.
BUT In case that is not the solution u wanna hear. Here’s the smoothest i could make it.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Rs = game:GetService("RunService")
local Test = Instance.new("Part", workspace)
Test.Anchored = true
Test.CanCollide = false
function Follow(Dt)
Test.CFrame = Test.CFrame:Lerp(Character.PrimaryPart.CFrame, 0.1)
end
Rs.Heartbeat:Connect(Follow)