Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does the camera not look at the player after it dies?

For some reason whenever the character dies it doesn't look back at the character again even after death even though it updates every frame. Also when the character falls and the model is destroyed then it gives an error saying 'Torso is not a valid member of model' even though I added an if statement.

Heres the script:

-- Scripted by ThePhantomDeveloper
local runService = game:GetService('RunService')

local zOffset = 20
local yOffset = 5

local player = game.Players.LocalPlayer
local character = player.Character
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

function onUpdate()
	if player and character and character.Torso then
		camera:Interpolate(CFrame.new(Vector3.new(character.Torso.Position.X, character.Torso.Position.Y + yOffset, character.Torso.Position.Z + zOffset)), CFrame.new(character.Torso.Position), 0.25)
	end
end

runService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onUpdate)

1 answer

✓ Accepted answer

Because the model gets destroyed, Torso doesn't exist anymore.

This discussion is preserved as it was. New answers, comments, and votes are closed.