Camera Direction Bug

If i Equip my Weapon the Camera Script goes on, my problem is that the camer direction is always the same (Example in my Video). I want to change, that the direction is always the same (where the char is looking at).

Local Script

local uis = game:GetService("UserInputService")


local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable


local char = script.Parent


local humanoid = char:WaitForChild("Humanoid")
humanoid.AutoRotate = true

local function getPlayerFromCharacter(character)
	for _, player in pairs(game:GetService("Players"):GetPlayers()) do
		if player.Character == character then
			return player
		end
	end
end

local player = getPlayerFromCharacter(char)
local mouse = player:GetMouse()
local hrp = char:WaitForChild("HumanoidRootPart")


local x = 0
local y = 0


local offset = Vector3.new(3, 3, 10)


uis.InputChanged:Connect(function(input, processed)

	if processed then return end

	if input.UserInputType == Enum.UserInputType.MouseMovement then

		x = x - input.Delta.X

		y = math.clamp(y - input.Delta.Y*0.4, -75, 75)


		hrp.CFrame = hrp.CFrame * CFrame.Angles(0, math.rad(-input.Delta.X), 0)
	end
end)


game:GetService("RunService").RenderStepped:Connect(function()

	uis.MouseBehavior = Enum.MouseBehavior.LockCenter


	local startCFrame = CFrame.new((hrp.CFrame.Position)) * CFrame.Angles(0, math.rad(x), 0) * CFrame.Angles(math.rad(y), 0, 0)
	local cameraCFrame = startCFrame:ToWorldSpace(CFrame.new(offset.X, offset.Y, offset.Z))
	local cameraDirection = startCFrame:ToWorldSpace(CFrame.new(offset.X, offset.Y, -10000))
	
	
	camera.CFrame = CFrame.new(cameraCFrame.Position, cameraDirection.Position)
end)

-Video
https://streamable.com/4g99q8

I’m very confused as to where you actually want the camera. Are you just trying to make it over-the-shoulder?

No its actually over the shoulder and its work but if i fire the scrip the camera direction is always at the same point as in a video
(when i equip the pistol) - Look at The crosshair is always in the same position (center of the camera)

please help i dont know how do i fix that

please help i dont know how do i fix that :frowning: :frowning:

no one can help me with that???