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

die camera not working ?

Asked by
Bulvyte 388 Moderation Voter
8 years ago

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

Log in to vote
2
Answered by 8 years ago

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.

Ad

Answer this question