So, I found a over the shoulder script that fit my needs and then tweaked it around a bit and now it’s having a spasm every time I aim or shoot. I disabled every single other script and it still does this and I have no idea why.
Here is the over the shoulder script.
local RUNSERVICE = game:GetService("RunService")
local PLAYERS = game:GetService("Players")
local UIS = game:GetService("UserInputService")
local CAMERA = workspace.CurrentCamera
local PLAYER = PLAYERS.LocalPlayer
local CHAR = PLAYER.Character or PLAYER.CharacterAdded:wait()
local ROOT = CHAR:WaitForChild('HumanoidRootPart')
local humanoid = CHAR:WaitForChild("Humanoid")
local ZOOM = 10
local ZOOMlower = 8
local ZOOMupper = 16
local ZOOMincr = 2
local X = 0
local Y = 0
local RX = 0
local RY = 0
local PANSPEED = 10
local SKEW = 0.1
workspace.CurrentCamera.CameraType = "Scriptable"
function halflerp(a,b,alpha)
return a+(b-a)
end
function PanCamera(dt)
UIS.MouseBehavior = "LockCenter"
local DELTA = UIS:GetMouseDelta()*SKEW
local ROOTCF = CFrame.new(ROOT.Position)
local OFFSET = CFrame.new(3,2,ZOOM)
local MODSPEED = PANSPEED*dt
X = X-DELTA.X
Y = math.clamp(Y-DELTA.Y,-70,70)
RX = halflerp(RX,math.rad(X),MODSPEED)
RY = halflerp(RY,math.rad(Y),MODSPEED)
local absOFFSET = CFrame.Angles(0,RX,0)*CFrame.Angles(RY,0,0)*OFFSET
CAMERA.CFrame = CAMERA.CFrame:Lerp(ROOTCF*absOFFSET,MODSPEED)
wait()
end
function SetZoom(input,other)
if other then return end
if input.UserInputType == Enum.UserInputType.MouseWheel then
local dt = input.Position.Z
if dt > 0 then
ZOOM = math.clamp(ZOOM-ZOOMincr,ZOOMlower,ZOOMupper)
elseif dt < 0 then
ZOOM = math.clamp(ZOOM+ZOOMincr,ZOOMlower,ZOOMupper)
end
end
end
workspace.CurrentCamera.CameraType = "Custom"
game.ReplicatedStorage.gunsystem.cameraswitch.Event:Connect(function(arg1)
if arg1 == true then
print("true")
workspace.CurrentCamera.CameraType = "Scriptable"
RUNSERVICE:BindToRenderStep('ShoulderCam',Enum.RenderPriority.Camera.Value - 1,PanCamera)
humanoid.AutoRotate = false
elseif arg1 == false then
print("false")
RUNSERVICE:UnbindFromRenderStep('ShoulderCam')
workspace.CurrentCamera.CameraType = "Custom"
humanoid.AutoRotate = true
end
end)
game.ReplicatedStorage.gunsystem.cameraswitch.Event:Connect(function(e, arg1)
if arg1 == true then
print("true1")
local ZOOM = 5
local ZOOMlower = 5
elseif arg1 == false then
print("false1")
local ZOOM = 10
local ZOOMlower = 8
local ZOOMupper = 16
end
end)
UIS.InputChanged:Connect(SetZoom)
Here is how it looks like.