It still snaps back to the camera when you stop moving!
Script:
local t = 0
wait(2)
game.ReplicatedStorage:WaitForChild("ViewModel").Parent = workspace.CurrentCamera
game:GetService("RunService").RenderStepped:Connect(function(dt)
if game.Players.LocalPlayer.Character.Humanoid.MoveDirection.Magnitude > 0 then
local x = math.sin(t * 5) * 0.25
local y = math.abs(math.sin(t * 5)) * 0.25
local cf = CFrame.new(x, y, 0)
workspace.CurrentCamera.ViewModel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame * cf)
else
workspace.CurrentCamera.ViewModel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame)
end
t += dt
end)