I need help with viewmodel bobbing and swaying

I need help

My viewmodel works but I can’t get it to sway.
https://gyazo.com/877357556e8bd9af07ebdaef926d8cb1

I have tried offsetting the camera but the viewmodel just follows the camera.

local enabled = false
script.Parent.Equipped:Connect(function()
	game.ReplicatedStorage.v_Template.Parent = game.Workspace.CurrentCamera
	local idle = Instance.new("Animation")
	idle.AnimationId = "rbxassetid://6059835776"
	ianimate = game.Workspace.CurrentCamera.v_Template.Animation:LoadAnimation(idle)
	enabled = true
	ianimate:Play()
	game:GetService("RunService").RenderStepped:Connect(function()
		if enabled then
			game.Workspace.CurrentCamera.v_Template.HumanoidRootPart.CFrame = game.Workspace.CurrentCamera.CFrame
		end
	end)
end)

script.Parent.Unequipped:Connect(function()
	enabled = false
	ianimate:Stop()
	game.Workspace.CurrentCamera.v_Template.Parent = game.ReplicatedStorage
end)
2 Likes

Your paradigm looks really similar to the FPS element of a first person shooter. If you are following that guy make sure to set the cameras state to scriptable and change the cframe while blocking the main loop call

It’s not. I made it by myself.

I’ve figured it out. Thanks for the support