Please help me make viewmodel aiming like in game "Deadline"

I tried so many times but it is works very bad

My current code:

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local viewmodel = game.ReplicatedStorage.Viewmodel:Clone() -- Это ссылка на Viewmodel
viewmodel.Parent = workspace
local cf = CFrame.new()
local lastcf = camera.CFrame

-- Настроим позицию и ориентацию viewmodel
local function updateViewModelPosition()
	local lobzik = camera.CFrame:ToObjectSpace(lastcf)
	local x,y,z = lobzik:ToOrientation()
	cf = cf:Lerp(CFrame.Angles(x,y,0), .1)
	viewmodel:SetPrimaryPartCFrame(camera.CFrame)
	viewmodel.HumanoidRootPart.CFrame = viewmodel.HumanoidRootPart.CFrame * cf
	lastcf = camera.CFrame
end

game:GetService("RunService").RenderStepped:Connect(updateViewModelPosition)

and video:

And example:

That’s not gun sway, it’s aiming the gun (or hands) to the mouse. Sway would be more of a walking movement.

Use the Search tool up top and use “1st person aim gun at mouse” or “1st person point arms at mouse” or “1st person point at mouse”.
There are quite a few posts about this already.

OK I wil try to search and make It

1 Like

so I found how to make It but there’s 1 problem that I fixed but not very good.
Anyways thank you very much for your help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.