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

Not working under Filtering..?

Asked by 9 years ago

Why doesn't this code work with FilteringEnabled? It works when you join the game, then when you die and respawn, it doesn't work anymore.

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

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Timer = ReplicatedStorage:WaitForChild("Timer")
local MapHolder = workspace:WaitForChild("MapHolder")
local SelectedMap = ReplicatedStorage:WaitForChild("SelectedMap")
local Playing = Player:WaitForChild("Playing")

local CurrentCamera = workspace.CurrentCamera

Angle = 0
while wait() do
    if Timer.Value > 0 and Playing.Value == false and Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Humanoid").Health > 0 then
        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 and Playing.Value == false and Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Humanoid").Health > 0 then
        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 Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Humanoid").Health > 0 then
        CurrentCamera.CameraSubject = Character:FindFirstChild("Humanoid")
    end
    Angle = Angle + math.rad(0.5)
end

Answer this question