Lerping inside RenderStepped seems excessive seeing as RenderStepped runs at the rate of your FPS, thus usually 60 times per second. Lerp should be used inside lower rate loops, to reduce the calculations while maintaining smoothness.
You also need the “lerp number” (the alpha) to be incremented inside the loop. I’m not entirely sure why the gun keeps falling but I’d assume it’s because of this or your model is unanchored. The alpha is the percentage between your current CFrame and the goal CFrame. Meaning your alpha number of 1 would just be the end result (you lerp does nothing), and 0.8 is the 80% between the current and end position.
You can increment the alpha number like so:
local Camera = game:GetService("Workspace").CurrentCamera
local alpha = 0
local rate = 0.1
while true do
alpha = (alpha + rate) % 1
newGun:PivotTo(newGun.PrimaryPart.CFrame:Lerp(Camera.CFrame, alpha))
task.wait(rate)
end
I’m assuming you just want to lock the model to the Camera. Lerping would be pointless, it will be smooth anyway because you are using RenderStepped. If you want the model to sway I would suggest using Springs to tween the CFrame.
ohh okay I’m gonna check out the springs, I never heard of it, but after looking it up, it seems like its what I’m looking for, is to have smoothness to the gun and make it look like your actually moving the gun around.