OTS gun system recoil

I am working on a OTS gun system for a game and I got the core mechanics in order and working.
Issue is that I am now trying to implement recoil to the guns however I am unsure of how to do so.

I’ve heard that springmodule was recommended for these kinds of things however I’ve never got it to work properly. I’ve scoured the internet & devforum for similar posts and I did find some, but when I tried to use their code to try and get SpringModule to work, it never did. Not to mention that there are no good tutorials about SpringModule.

I did try to run with camera CFrames but that did not help as the recoil was snappy and did not go back to the original position like how recoil usually works, you do not shoot into the air and then hold it there afterall.

I am trying to replicate the recoil of systems similar to Phantom Forces, but for a OTS system.
Any tips or directions?

-- I tried something like this.
local runserv = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
local player = game:GetService("Players")

local camera = workspace.CurrentCamera
local replicatedS = game.ReplicatedStorage
local Spring = require(replicatedS.Spring)
local localplayer = player.LocalPlayer
local mouse = localplayer:GetMouse()

local connection
StiffSpring = {2, 10, 75, 0, 50, 50};
local spring = Spring.new(1,1,1)--table.unpack(StiffSpring)

	local updatedspring = spring.Offset
	camera.CFrame *= CFrame.Angles(math.rad(updatedspring),0,0)


The spring 1,1,1 values are to make sure it worked.

This did not do anything though as it gave me errors with shove not working.
overall I noticed that there are multiple spring modules and versions, there is no clear tutorial or anything.

This here is my camera module that handles and manages the OTS system, or at least the code snippet for it.

local function applyCameraOffset()
	if Toggled and character then
		UserGameSettings.RotationType = Enum.RotationType.MovementRelative
		character.Humanoid.AutoRotate = false

		local root = character.HumanoidRootPart
		local currentCFrame = camera.CFrame
		local offsetCFrame = CFrame.new(cameraOffset) * CFrame.Angles(offsetAngle.X, offsetAngle.Y, offsetAngle.Z)
		camera.CFrame = currentCFrame * offsetCFrame
		local _, y = workspace.CurrentCamera.CFrame.Rotation:ToEulerAnglesYXZ()
		local tween = TweenService:Create(root, tween, {CFrame = CFrame.new(root.Position) * CFrame.Angles(0,y,0)})

This module runs through RunService, Renderstepped.
So basically, all the time while the player aims the weapon.

Most of my system is already done and works but I cannot get the recoil to work.
How do I recoil the camera upwards and then make it return to the original position?


This is so good … Could do what you’re looking for and much more.
EZ Camera Shake ported to Roblox


Great suggestion, however I’ve tried this before and It’s simply not It, the results were inconsistent.
It shakes differently based on studio, player modes.

For example, I can make perfectly balanced recoil in studio and it works as expected but when in the main game, like final release let’s say it shakes completely differently.
It can vary from no shaking at all to as if there was a car that exploded behind you.

I do not want to implement this as a solution.