I am trying to add sway to my weapon and arms in fps game

Here is the script piece that makes my arms follow where I look in game. I had someone help me with the math cause I am not the best at it. I am trying to add a sway to the arms after each mouse movement. I know about springs and lerping but I dont know how to apply them to my code.

local headCf = Head.CFrame
local BodyAttCf = tool.GlockFrame.CFrame
local pitchAngle = math.asin(CamZ.CFrame.LookVector.Y)
local UpDoMov = CFrame.Angles(pitchAngle, 0, 0)  * CFrame.Angles(0, math.rad(180), 0)
charac.Head.ToolGrip.C0 = UpDoMov

This script is rederstepped to update every frame. Please help me understand how I can add weapon sway to a system like this. Thanks.

I think this post belongs in #help-and-feedback:scripting-support I suggest moving it before someone flags it.

I have done something similar in this other post I guess go check it out:

Please make sure to put it in LUA Blocks so it is easier to read!

local headCf = Head.CFrame
local BodyAttCf = tool.GlockFrame.CFrame
local pitchAngle = math.asin(CamZ.CFrame.LookVector.Y)
local UpDoMov = CFrame.Angles(pitchAngle, 0, 0) * CFrame.Angles(0, math.rad(180), 0)
charac.Head.ToolGrip.C0 = UpDoMov

Add these little things ``` to do it. Example:

local hi = workspace.Baseplate

hi.OnTouched:Connect(function(example)
example:Destroy()
end

I wish I could understand what your doing here. Ill give it a shot. Thanks.

I am getting this error. I dont know what to do, please let me know what you think the issue is. Thanks.

Infinite yield possible on ‘Players.shrekked117.PlayerScripts.Spring:WaitForChild(“Spring”)’

Actually it works! Thanks. Now I have to apply this to my own script.