Camera Manipulation with Filtering?
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.
01 | repeat wait() until game:GetService( "Players" ).LocalPlayer |
03 | local Player = game:GetService( "Players" ).LocalPlayer |
04 | local Character = Player.Character or Player.CharacterAdded:wait() |
05 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
06 | local Timer = ReplicatedStorage:WaitForChild( "Timer" ) |
07 | local MapHolder = workspace:WaitForChild( "MapHolder" ) |
08 | local SelectedMap = ReplicatedStorage:WaitForChild( "SelectedMap" ) |
09 | local Playing = Player:WaitForChild( "Playing" ) |
11 | local CurrentCamera = workspace.CurrentCamera |
15 | if Timer.Value > 0 and Playing.Value = = false and Character:FindFirstChild( "Humanoid" ) and Character:FindFirstChild( "Humanoid" ).Health > 0 then |
16 | CurrentCamera.CameraSubject = MapHolder:FindFirstChild(SelectedMap.Value):FindFirstChild( "PartCAM" ) |
17 | CurrentCamera.CoordinateFrame = CFrame.new(MapHolder:FindFirstChild(SelectedMap.Value):FindFirstChild( "PartCAM" ).Position) * CFrame.Angles( 0 , Angle, 0 ) * CFrame.new( 0 , 0 , - 25 ) |
18 | elseif Timer.Value < 0 and Playing.Value = = false and Character:FindFirstChild( "Humanoid" ) and Character:FindFirstChild( "Humanoid" ).Health > 0 then |
19 | CurrentCamera.CoordinateFrame = CFrame.new(workspace.Scene:FindFirstChild( "PartCAM" ).Position) * CFrame.Angles( 0 , Angle, 0 ) * CFrame.new( 0 , 0 , - 10 ) |
20 | CurrentCamera.CameraSubject = workspace.Scene:FindFirstChild( "PartCAM" ) |
21 | elseif Timer.Value > 0 and Playing.Value = = true and Character:FindFirstChild( "Humanoid" ) and Character:FindFirstChild( "Humanoid" ).Health > 0 then |
22 | CurrentCamera.CameraSubject = Character:FindFirstChild( "Humanoid" ) |
24 | Angle = Angle + math.rad( 0.5 ) |