How could I make a gun shoulder cam?

Hey developers!

How could I go about making a tool/gun shoulder cam? So basically when the player equips the tool the shoulder cam becomes active, then when the player unequips the tool the shoulder cam goes off.

Any help appreciated!

Does anyone know how to do this?

Try tweening the player’s camera to the left/right when the tool is equipped.

Tween | Roblox Creator Documentation (Tween page)
Camera | Roblox Creator Documentation (Camera page)

How would I do that though? Have a part next to the player’s head when the join the game and then tween the camera to the part when they equip a tool?

I also would want the player’s mouse to be locked to the centre of the players screen.

You can tween the CFrame value of the camera.

Example:

local TweenService = game:GetService("TweenService")

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()

local Camera = game:GetService("Workspace").CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable

local Tween = TweenService:Create(Camera, TweenInfo.new(0.5), {["CFrame"] = Camera.CFrame * CFrame.new(-1,0,0)})

Tween:Play()

This isn’t perfect, as it doesn’t move with the camera, and stays in the same spot until the tween is finished and then reverts back to the normal camera, but see what you can do with this.

Making an over-the-shoulder camera comes with some really complicated and unique problems that can be difficult to work around and a completely custom camera like what @Unarthadoxx is recommending above is absolutely the best quality solution.

If you want a quick built-in Roblox system that will let you have an over-the-shoulder camera, consider messing with the CameraOffset property of the humanoid. ((1.5,0.5,0.0) gives a nice position over the shoulder when shift lock is enabled) but I really can’t recommend it for anything more than prototypes.

(edit: replied to unarthadoxx but meant to reply to op, sorry in advance)