CameraSubject breaks ShiftLock/FirstPerson

I really like how the camera follows the player if its on the head for animations
But it breaks that, does anyone know any way to fix?

See if my system works with it.

If not, though, you simply shouldn’t set the subject to the head. From a player perspective it’s quite jarring.

How do games like Strongest Battlegrounds do it then?

By using their own camera system.

1 Like

Do u have any like resource I can learn from to make my own one?

You could try disabling the Humanoid’s AutoRotate property and changing the player’s CFrame to rotate towards the camera’s CFrame.

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

local Camera = workspace:WaitForChild("Camera")
Camera.CameraSubject = Character:WaitForChild("Head")

local function OnRenderStep()
	if not Character or not Humanoid then
		return
	end
	
	if UserInputService.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
		Humanoid.AutoRotate = true --We set the Humanoid's AutoRotate to true if we aren't in shift lock mode.
		return 
	end
	
	Humanoid.AutoRotate = false
	
	local X, Y, Z = Camera.CFrame:ToOrientation()
	Character:PivotTo(CFrame.new(Character:GetPivot().Position) * CFrame.fromOrientation(0, Y, 0))
end

RunService.RenderStepped:Connect(OnRenderStep)

Yea, this does work, thank you.

Anyway what I truly should do is make my own camera system like @iGottic said, I’ll be looking into it but it seems pretty hard.

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