Camera CFrame Issue

When I perform the roll animation the cameras cframe is positioned to the head and when its done rolling it returns to normal. Why is it when the rolling animation is over it skips to the last position I looked at before I roll? I know it’s because the cameras cframe is attached to the head but I was wondering how to make it not skip to the last position looked before rolling.

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

local Player = Players.LocalPlayer
local Mouse = Player:GetMouse()
local Camera = workspace.CurrentCamera
local Humanoid = Player.Character:WaitForChild("Humanoid")
local Character = Player.Character
local Head = Character:WaitForChild("Head")

UserInputService.MouseIconEnabled = true

RunService.RenderStepped:Connect(function(deltaTime)
	if Character:GetAttribute("Rolling") then
		Camera.CFrame = Head.CFrame
	end
end)

Have you tried putting the CameraType to Scriptable?

You can do this by setting the camera property to it via a script!

Camera.CameraType = Enum.CameraType.Scriptable

I’ve tried that already, unfortunately it didn’t change anything.

Seeing your edit, I would assume that a good idea would be to use a CFrame LookAt value in the direction the head or HumanoidRootPart is facing.

how would I go about doing that?

Sorry but, I do not know CFrame Rotations that much (especially in the “look” types) , so I’d recommend looking on the Documentation.

I also apologize, You should use LookVector AND LookAt (in theory)

You can check out the CFrame Documentation which contains both LookVector and LookAt documentation!
Happy Scripting!

Me personally, I do think you would use CFrame.LookVector.

As Alice said you should check out the CFrame documentation and also you have a really great AlvinBlox Video and DevKing Video that explains CFrame really well.

AlvinBlox CFrame Tutorial

TheDevKing CFrame Tutorial

Both Explain the Usage of CFrame really well!