Why is my head in first person locked into a position where it doesn't sync with the animations?

The issue I’m having, is that the camera when you go into first person, stays in one position where it doesn’t move.

What is happening:

What I want:

I already have a script, the issue is that the camera is somehow locked in first person where it doesn’t move at all, even when prompted in the script.

THE SCRIPT:

local Intensity = 10

local xMagnitude = .5
local yMagnitude = .5

local plr = game:GetService("Players")
local rs = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local player = plr.LocalPlayer
local cam = workspace.CurrentCamera
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")

--//Setups

player.CameraMaxZoomDistance = 0
player.CameraMinZoomDistance = 0

--//Functions

function update()
	local currentTime = tick()
	if hum.MoveDirection.Magnitude > 0.5 then
		local x = math.cos(currentTime * Intensity) * xMagnitude
		local y = math.abs(math.sin(currentTime * Intensity)) * yMagnitude

		local bobble = Vector3.new(x,y, 0.5)

		hum.CameraOffset = hum.CameraOffset:lerp(bobble, .25)

		return
	end
	hum.CameraOffset *= .75
end

RunService.RenderStepped:Connect(update)

Roblox’s default Camera script does not follow the head position in animations, and the script you provided only does a bobble. You’ll have to code that yourself or look it up on the internet, I don’t think it’s difficult.

1 Like

I’ve looked everywhere, and they’re all really irrelevant and not the issue. What I’m wondering is, is maybe setting the camera subject to the player humanoid, although I wouldn’t know how to script that entirely.

I recall needing first person to line up with animations and finding a piece of code for it somewhere.

If I’m not mistaken, Roblox does this already by default.

1 Like

The camera subject is already set to the humanoid by default.

1 Like

From what i can understand, you want the camera to focus on the head during animations, the easiest way to do this is to set the CameraSubject to the head when the animation starts, then when it ends you set the CameraSubject back to the humanoid.

1 Like

I found the issue, the camera bobble just needed to be separated from the script entirely, into a fresh new one.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.