Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Resetting Camera after Death?

Asked by 4 years ago

I'm planning on having a special camera angle for when a player falls off a ledge. I'm able to switch to the special camera just fine, but no matter what I do, I can't get the camera back to normal after the player respawns. I've tried setting the Camera mode to Follow, making the player the focus, manually setting an offset, but nothing works. Even when the camera DOES follow the player, it is very zoomed out, and I'm not sure how to get it back to the default zoom. What should I be doing?

local debounce = false
local player = game.Players.LocalPlayer
player.CharacterAdded:wait()

while true do
    if game.Players.LocalPlayer.Character.Torso.CFrame.Y < -17 and debounce == false then
        debounce = true
        local camera = Instance.new("Camera")
        camera.Name = "DeathCamera"
        camera.Parent = workspace
        camera.CFrame = game.Players.LocalPlayer.Character.Torso.CFrame
        camera.CameraSubject = game.Players.LocalPlayer.Character.Torso
        camera.CameraType = Enum.CameraType.Watch
        workspace.CurrentCamera = camera
        repeat wait()
        until game.Players.LocalPlayer.Character.Humanoid.Health == 0
        wait(3)
        camera:Destroy()
    end
end

localPlayer.CharacterAdded:Connect(function(char)
    --game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end)

Answer this question