Make gun shoulder fire camera offset

how do i do that? i want the cramera to be over your shoulder. please help

By updating the camera CFrame on a RenderStepped connection.

See:

-- Get the player and their character
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

-- Create a new camera
local camera = Instance.new("Camera")
camera.Parent = game.Workspace.CurrentCamera

-- Attach the camera to the player's shoulder
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = CFrame.new(humanoidRootPart.Position + Vector3.new(0, 2, 0), humanoidRootPart.Position)

-- Update the camera's position and look direction every frame
game:GetService("RunService").RenderStepped:Connect(function()
    camera.CFrame = CFrame.new(humanoidRootPart.Position + Vector3.new(0, 2, 0), humanoidRootPart.Position)
end)

To use this script, simply insert it into a LocalScript inside StarterPlayerScripts or any location inside the LocalPlayer’s PlayerScripts.

This script creates a new camera and attaches it to the player’s humanoid root part (shoulder) by setting its CameraType to Scriptable. The camera’s position is initially set to be slightly above the humanoid root part, and its look direction is towards the humanoid root part. Finally, the script continuously updates the camera’s position and look direction every frame to keep it correctly attached to the shoulder.

Feel free to adjust the position (specified as Vector3.new(0, 2, 0)) to suit your desired shoulder position.

Because I can’t know your starter character or your vector3 goal.

I’m sorry if script doesn’t work I tried my best😊

You don’t need to instantiate a camera here, you can use the camera provided by workpace.CurrentCamera

1 Like

:+1::saluting_face:
Thanks, I usually take the long route for no reason🤷