Honesty annoyingly easy to fix, had this problem when trying to change the CameraSubject to the player’s head. All you have to do is this:
(local script)
local player
local mouse = player:GetMouse()
local char = player.Character
local hrp = char:FindFirstChild("HumanoidRootPart")
mouse.TargetFilter = workspace
(any loop) then
if UserInputService.MouseBehavior == Enum.MouseBehavior.LockCenter then
hrp.CFrame = CFrame.new(hrp.Position,Vector3.new(mouse.Hit.X,hrp.Position.Y, mouse.Hit.Z))
end
end
Maybe change the cameras CFrame instead of camerasubject for example:
local camera = game.Workspace.Camera
camera.CameraType = enum.CameraType.Scriptable
camera.CFrame = player.Chracter.HumanoidRootPart.CFrame - Vector3.new(0, 0, -5) -- change player to actual person
I didnt try this in studio and im not sure its 100% But hopefully it gives you an idea on how setting the cframe of the camera might work. The code does need some tweaking because the camera would look very weird if it was like that. Maybe try lookvector
I don’t believe this would follow the head throughout animations though, that’s why I changed the camera subject to the head. The code you sent would make the camera only focus 5 studs above the HumanoidRootPart whether or not the head moves away from that position.