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

die camera not working ?

this should slowly go out from camera when dead but just locks the camera and doesn't let me move it nor anything else. Help ?

repeat wait() until game.Players.LocalPlayer.Character
local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
cam.CameraType = "Custom"
cam.CameraSubject = player.Character.Head

player.Character.Humanoid.Died:connect(function()
cam.CameraType = "Scriptable"
cam:Interpolate(CFrame.new(cam.CFrame-cam.CFrame.lookVector*5),player.Character.Head,5)
end)

1 answer

✓ Accepted answer

There were a few errors in your code; I have corrected them below. I also noticed that the camera would not reset; I have fixed that also. Finally, the script would only run once. Again, I've fixed that.

local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera

player.CharacterAdded:connect(function()	
	player.Character.Humanoid.Died:connect(function()
		cam.CameraType = "Scriptable"
		cam:Interpolate(CFrame.new(cam.CoordinateFrame.p - cam.CoordinateFrame.lookVector*5),player.Character.Head.CFrame,5)
	end)
end)

cam.InterpolationFinished:connect(function()
	cam.CameraType = "Custom"
	cam.CameraSubject = player.Character.Head
end)

Hopefully this helps.

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