Aiming down sight with a gun tool

how do i make aiming down sight but the problem is its not a normal viewmodel its only head and torso on local players camera when i go first person it looks like a viewmodel so u can look up and the arms will follow with sway bob etc i dont need to animate the viewmodel arms beacuse it doesnt have i only use a normal npc for animating

so heres a video on how it works
robloxapp-20250312-2131246.wmv (2.5 MB)
image

i just wanna understand what i method i should use for example :pivotto or lookat etc

heres script im using aimpart

RunService.RenderStepped:Connect(function(dt)
	
	
	

	
	
	if Aiming  then
	
	end
	
end)

InputService.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton2 then
		if Equiped then
			Aiming = true
			
		
		end
		
	end
end)

InputService.InputEnded:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton2  then
		if Equiped then
			Aiming = false
		end
	end
end)

put an attachment on the gun on where the camera should be positioned and where the camera should point

then set the camera type to scriptable and use the cframe.lookat constructor

camera.CameraType = Enum.CameraType.Scriptable

--change render priority if this lags behind the gun
game:GetService("RunService").RenderStepped:Connect(function()
  camera.CFrame = CFrame.new(positionAttachment.Position, lookAt.WorldPosition)
end)

i dont understand what do you mean with use the cframe.lookat constructor

You should put AimPart or simply set position where player should aim, then use this position and head’s position (Player’s camera’s CFrame is equal Head’s CFrame in first person) to determine relative vector from head to aim part, and move camera to this relative cframe

i tried but i just keep spinning around

RunService.RenderStepped:Connect(function(dt)

if Aiming and Head then
Camera.CameraType = Enum.CameraType.Scriptable

  local relativeCFrame = Head.CFrame:ToObjectSpace(AimPart.CFrame)

  
  AimCf = AimCf:Lerp(Head.CFrame * relativeCFrame, 0.1)


  Gun:PivotTo(AimCf)

  
  Camera.CFrame = AimCf

end
end)

Maybe try using humanoid.CameraOffset