How to make this third person camera / gun camera

I already asked this 2 hours ago and I thought I found a fix…
Yea the “fix” isn’t working

This is the content of the old post :

Im trying to make this gun-camera system : https://www.youtube.com/watch?v=XgN4Wpbpd-w&t=

This is what I got yet :

local cam = game.Workspace.CurrentCamera

cam.CameraType = Enum.CameraType.Attach

local RunService = game:GetService"RunService"

local UserInputService = game:GetService"UserInputService"

RunService:BindToRenderStep("MouseLock",Enum.RenderPriority.Last.Value+1,function()

UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

local face = char:FindFirstChild("HumanoidRootPart").CFrame.LookVector

cam.CFrame = CFrame.new(char:FindFirstChild("HumanoidRootPart").WeaponCam.WorldPosition, Vector3.new(face.X * 9999, char:FindFirstChild("HumanoidRootPart").WeaponCam.WorldPosition.Y, face.Z * 9999))

I used UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter to put the mouse in the middle of the screen but I want that the character is following the mouse

I know this is very basic but I didnt scripted for like 6-7 months now :confused:

I hope you can help me

You can register mouse input even when the mouse is locked to the center. UserInputService.InputChanged fires when the mouse moves, and passes an InputObject as the first argument. If the input corresponds to mouse movement, the UserInputType will be MouseMovement and InputObject.Delta the magnitude of the mouse movement as a Vector3. Use this mouse movement to rotate the character or the camera. To rotate the camera independently of the mouse (e.g. for looking up and down), you can multiply the character CFrame by some “camera offset” CFrame, and rotate the offset up/down instead of the character.

2 Likes

Your MouseBehavior is possibly being overriden by the CameraModule Update method which updates the mouse behavior inside it.

Simply, fork the PlayerModule (found in game => Players => Player => PlayerScripts) and paste it into StarterCharacterScripts in studio. Then go to PlayerModule.CameraModule line 470 and you’ll find the UpdateMouseBehavior method being called. All you need to do is comment it out.

1 Like

Yepppppp this still dont work :c