Trying to add sway to a gun

Im making a fps and I need sway for my guns, any help with that?
Script:

RunService.RenderStepped:Connect(function(step)
	local increment = RATE_PER_SECOND * step
	local camframe = game:GetService("Workspace").CurrentCamera.CFrame
	script.Parent.PrimaryPart.CFrame = camframe + camframe.LookVector * 0 + camframe.UpVector * 0 + camframe.RightVector * 0
	script.Parent.PrimaryPart.CFrame = script.Parent.PrimaryPart.CFrame:Lerp(camframe, 1)
	script.Parent["Left Arm"].BrickColor = game.Workspace:FindFirstChild(playerName):WaitForChild("Body Colors").LeftArmColor
	script.Parent["Right Arm"].BrickColor = game.Workspace:FindFirstChild(playerName):WaitForChild("Body Colors").RightArmColor
	game.Players.LocalPlayer.PlayerGui:WaitForChild("UI").Main.Ammo.Text = script.Parent.Ammo.Value
	if game.Workspace:FindFirstChild(playerName):FindFirstChild("Shirt") then
		script.Parent["Left Arm"].Decal.Texture = game.Workspace:FindFirstChild(playerName).Shirt.ShirtTemplate
		script.Parent["Right Arm"].Decal.Texture = game.Workspace:FindFirstChild(playerName).Shirt.ShirtTemplate
	end
end)

You should check this thread, as this question is exact of that in the thread, which is actually resolved and script of the mechanic and video demonstration is there too.

Ive seen that but dont know how to impliment it.