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

Help with Camera Man. after Respawn?

Asked by 9 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.

Why doesn't this work after a player respawns? The LocalScript is located inside the PlayerGui.

repeat wait() until game:GetService("Players").LocalPlayer

local Player = game:GetService("Players").LocalPlayer
local Playing = Player:WaitForChild("Playing")
local Character = Player.Character
local Humanoid = Character:FindFirstChild("Humanoid")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Timer = ReplicatedStorage:WaitForChild("Timer")
local MapHolder = workspace:WaitForChild("MapHolder")
local SelectedMap = ReplicatedStorage:WaitForChild("SelectedMap")
local Database = script.Parent:WaitForChild("Database")

local CurrentCamera = workspace.CurrentCamera

Angle = 0
while wait() do
    if Timer.Value > 0 and Playing.Value == false and Humanoid and Humanoid.Health > 0 and Database.Visible == false then
        CurrentCamera.CameraType = "Scriptable"
        CurrentCamera.CameraSubject = MapHolder:FindFirstChild(SelectedMap.Value):FindFirstChild("PartCAM")
        CurrentCamera.CoordinateFrame = CFrame.new(MapHolder:FindFirstChild(SelectedMap.Value):FindFirstChild("PartCAM").Position) * CFrame.Angles(0, Angle, 0) * CFrame.new(0, 0, 25)
    elseif Timer.Value < 0 or Database.Visible == true and Playing.Value == false and Humanoid and Humanoid.Health > 0 then
        CurrentCamera.CameraType = "Scriptable"
        CurrentCamera.CoordinateFrame = CFrame.new(workspace.Scene:FindFirstChild("PartCAM").Position) * CFrame.Angles(0, Angle, 0) * CFrame.new(0, 0, 10)
        CurrentCamera.CameraSubject = workspace.Scene:FindFirstChild("PartCAM")
    elseif Timer.Value > 0 and Playing.Value == true and Humanoid and Humanoid.Health > 0 then
        CurrentCamera.CameraType = "Custom"
        CurrentCamera.CameraSubject = Humanoid
    end
    Angle = Angle + math.rad(0.5)
end

Answer this question