I’m making a fps framework (wow! how original!) and I’ve made a gun sway for when you walk, however, when the animation starts it just cuts straight to it without transitioning.
Example:
My code:
local function AttachToCamera()
local t = tick();
local bobbleX = math.cos(t * 5) * .05;
local bobbleY = math.abs(math.sin(t * 5)) * .05;
local bobble = CFrame.new(bobbleX, bobbleY, 0);
if humanoid.MoveDirection.Magnitude > 0 then else
bobble = CFrame.new(0,0,0)
end
viewmodel:SetPrimaryPartCFrame(
camera.CFrame
*
bobble
)
end
runservice.RenderStepped:Connect(AttachToCamera)
Any help is appreciated!