How to move your gun smoothly along with your cursor in FPS game?

I was trying to develop an FPS system over the last few week mainly because my racing project before get some trouble related to mathematic but there is a nice guy in the forum willingly spend time to help me developing the suspension system. However, if the car suspension system is fixed and i successfully make an efficient FPS system, a game similar to base battle( might be made in the future.

Anyway, let’s get back to the question if you take a look at the video below, you might notice the problem which is the hand and the gun doesn’t move smoothly with the cursor and it appears to have small undesire glitches. Is there anyway to fix this problem as well as preventing it?

This is a brief description about how do i make this system:
The equipped pose( the pose when you are holding the gun) was made by using an animation that loops constantly unlike traditional system that use fake arms to simulate the pose. The hand and the gun follow my cursor by calculating the angle using trigonometry as demonstrated in this code:

local mousepos = mouse.Hit.p
local headcframe = head.CFrame.p
local height = mousepos.Y-headcframe.Y
local distance = (mousepos - headcframe).Magnitude
local angle = math.asin(height/distance)
local turn = CFrame.fromAxisAngle(originCFrame.RightVector,angle)


> Note: it is relatively a simple way to make it following my cursor and the turn variable is sent from the client to the server using remote event, if anyone knows how to fix it, feel free to leave some replies


Look at section 8 - aiming and springs. It goes over how to use a spring module to create smooth arm movement with a springiness to them and sway. Hope this helps.

oh thanks for your recommendation. I’ll check it out soon

I believe this post might help you with that: