How to stop animation from making cameraSubject switch between Head and Humanoid

You can write your topic however you want, but you need to answer these questions:
i want to make it so when player goes in first person camera wont follow the player head but when player is in third person camera will follow the player head

when i go in first person it works but when i run the cameraSubject starts switching between Head and Humanoid

here is the video to show what it does:
(SEIZURE WARNING)

this is the code to change between head and humanoid depending on if player is in first or third person

local Player = game.Players.LocalPlayer;
local Character = Player.Character
local Camera = game.Workspace.CurrentCamera;
local Head = Character:WaitForChild(“Head”);

while wait() do
if (Head.CFrame.p - Camera.CFrame.p).Magnitude < 1 then
game.Workspace.Camera.CameraSubject = Player.Character.Humanoid
else
game.Workspace.Camera.CameraSubject = Head
end
end
i have tried to change the number at this part of the code
(if (Head.CFrame.p - Camera.CFrame.p).Magnitude < 1 then)
but when i make it too low the cameraSubject wont change to humanoid and stay on head
i am 99% certain that the problem is the animation but i have no idea how i can fix it

1 Like

try making distance <= 2 if < 1 not working

1 Like

It did work thank you very much!

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