Help with kill-cam

Hello,
I’m experimenting with a kill cam system, however the problem is, that the orientation is not correct. I want it to directly be in front of the player’s head, and follow it, so if they turn, the camera turns, however It’s completely random. I want it so you see the players head and what’s behind them, fixed, just like in arsenal. However, sometimes it’s behind them, sometimes on the left or the right, never in the right orientation. Rotating doesn’t help.

Here is the code I’m using:

local function KillCam(Killer)
	camera.CameraSubject = Killer.Character.Humanoid
	camera.CameraType = Enum.CameraType.Scriptable
	camera.FieldOfView = 50
	game.Lighting.DepthOfField.Enabled = true
	
	game:GetService('RunService'):BindToRenderStep('killCam',Enum.RenderPriority.Camera.Value - 1, function()
		camera.CFrame = CFrame.new(Killer.Character.HumanoidRootPart.Position) * CFrame.new(0,2,10)
	end)
	
	wait(3.5)
	game:GetService('RunService'):UnbindFromRenderStep('killCam')
	camera.CameraType = Enum.CameraType.Custom
	camera.FieldOfView = 70
	game.Lighting.DepthOfField.Enabled = false
	spawn(function()
		camera.CameraSubject = character.Humanoid
	end)
end

How could I achieve this? I would greatly appreciate some help, as this is a big problem for me. I just can’t understand why it doesn’t focus only on the head and is random every time, Thanks!

Just do

Killer.Character.HumanoidRootPart.CFrame* CFrame.new(0,2,10) * CFrame.Angle(0,0, math.rad(180))

Since your just creating a new cframe with no orientation keeping it in place, so use the HRP’s CFrame to stay infront. Also add the CFrame.Angle() so it faces the player

1 Like