How do I make the camera follow the head in first person animation?

it works! one little detail is that the player turns, im guessing to the direction the Part is facing. any way to fix that?

also, thank you so much for doing this for me. i appreciate it.

That is odd, when I test it does not happen

maybe you could provide a recording so I can see what is happening

robloxapp-20220729-1845406.wmv (833.5 KB)

does it happen when the character is in third person?

the game is lockedfirstperson, so i’m not sure

try replacing this line with

Camera.CFrame = Character.Head.CFrame

now that makes my character rotate until the animation is finished…

try this

local RunService = game:GetService("RunService")
local Camera = game.Workspace:WaitForChild("Camera")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://10405924371" --    10406276727  10406528662

local PlayersService = game:GetService("Players")

local Player = PlayersService.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")

local AnimationTrack = Animator:LoadAnimation(Animation)

local TouchedConnection

TouchedConnection = game.Workspace.Test.Touched:Connect(function()
	TouchedConnection:Disconnect()

	AnimationTrack:Play()

	Humanoid.WalkSpeed = 0

	local AnimationEnded = false

	AnimationTrack.Stopped:Connect(function()
		AnimationEnded = true
	end)

	Camera.CameraType = Enum.CameraType.Scriptable

	while AnimationEnded == false do
		Camera.CFrame = CFrame.new(Camera.CFrame.Position, Character.Head.Position)

		RunService.RenderStepped:Wait()
	end
	
	Camera.CFrame = Character.Head.CFrame

	Humanoid.WalkSpeed = 16

	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = Humanoid
end)

that doesn’t seem to work either. i’ve realized that its not the part’s roration, the character just gets turned around in a 360

did you change the character’s speed to keep it in place?

yep, when the animation plays my character does a 360, and i’m not controlling it. the player can’t move until the animation is done

This is the last I could think of

local RunService = game:GetService("RunService")
local Camera = game.Workspace:WaitForChild("Camera")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://10405924371" --    10406276727  10406528662

local PlayersService = game:GetService("Players")

local Player = PlayersService.LocalPlayer

local Character = Player.Character or Player.CharacterAdded:Wait()

local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")

local AnimationTrack = Animator:LoadAnimation(Animation)

local TouchedConnection

TouchedConnection = game.Workspace.Test.Touched:Connect(function()
	TouchedConnection:Disconnect()

	AnimationTrack:Play()

	Character.Head.Anchored = true

	local AnimationEnded = false

	AnimationTrack.Stopped:Connect(function()
		AnimationEnded = true
	end)

	Camera.CameraType = Enum.CameraType.Scriptable
	
	while AnimationEnded == false do
		Camera.CFrame = CFrame.new(Camera.CFrame.Position, Character.Head.Position)

		RunService.RenderStepped:Wait()
	end
	
	Character.Head.Anchored = false

	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = Humanoid
end)
3 Likes

that worked! thank you so much for everything. appreciate it.