Need help with FPS Gun movement

hello, i’m starting to make a First person shooter game, but i ran into a problem with gun movement, i have a script which moves you hand up and down on y axis depending on mouse position, how ever, when i look down the gun moves too far from the camera and when i look up its too close
here is what i mean by looking up and down:

here is the script i used for my hand movement

local RunService = game:GetService("RunService")

local Player = game.Players.LocalPlayer
local PlayerMouse = Player:GetMouse()

local Camera = workspace.CurrentCamera

local Character = Player.Character or Player.CharacterAdded:Wait()
local Head = Character:WaitForChild("Head")

local Arm = Character:WaitForChild("RightUpperArm")
local Shoulder = Arm:WaitForChild("RightShoulder")

local ShoulderOriginC0 = Shoulder.C0

RunService.RenderStepped:Connect(function()
	local CameraCFrame = Camera.CoordinateFrame

	if Character:FindFirstChild("UpperTorso") and Character:FindFirstChild("Head") then
		local ArmLookVector = Arm.CFrame.lookVector
		local HeadPosition = Head.CFrame.p

		if Shoulder then
			if Camera.CameraSubject:IsDescendantOf(Character) or Camera.CameraSubject:IsDescendantOf(Player) then
				local Point = PlayerMouse.Hit.p

				local Distance = (Head.CFrame.p - Point).magnitude
				local Difference = Head.CFrame.Y - Point.Y

				Shoulder.C0 = Shoulder.C0:lerp(ShoulderOriginC0 * CFrame.Angles(-(math.asin(Difference / Distance)), (((HeadPosition - Point).Unit):Cross(ArmLookVector)).Y, 0), .5 / 2)
			end
		end
	end	
end)

what could i do to fix this issue and have the gun stay the same distance from the camera no matter the direction you are looking at and is there a way i could change my script to R6 because its only R16 right now.

1 Like

actually you are position the gun withing the player shoulder so its not an issue if you can try to lower the shoulder

2 Likes

now that you say that it does make a lot of sense, but how about would i do that? which Instance should i edit to achieve this?

1 Like

Have you heard of Viewmodels? They are a life saver in this situation. This link will help you.

1 Like