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

Camera Manipulation with Filtering?

Asked by 10 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.

01repeat wait() until game:GetService("Players").LocalPlayer
02 
03local Player = game:GetService("Players").LocalPlayer
04local Character = Player.Character or Player.CharacterAdded:wait()
05local ReplicatedStorage = game:GetService("ReplicatedStorage")
06local Timer = ReplicatedStorage:WaitForChild("Timer")
07local MapHolder = workspace:WaitForChild("MapHolder")
08local SelectedMap = ReplicatedStorage:WaitForChild("SelectedMap")
09local Playing = Player:WaitForChild("Playing")
10 
11local CurrentCamera = workspace.CurrentCamera
12 
13Angle = 0
14while wait() do
15    if Timer.Value > 0 and Playing.Value == false and Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Humanoid").Health > 0 then
View all 25 lines...
0
So hard to read....Consider using more variables.... NotsoPenguin 705 — 10y
0
So this helps me with my issue.. how? peoplemove12 148 — 10y
0
It helps with legibility. You have a lot of repeated code. ex, instead of having 'Character:FindFirstChild("Humanoid")' 7 times, just have it once between lines 14 and 15 as 'local humanoid = Character:FindFirstChild("Humanoid")' and 'if humanoid and humanoid.Health > 0 then --[[lines 15-23 here]] end". Same idea with PartCAM. Also, this script doesn't manage the player respawning; what does? chess123mate 5873 — 10y

Answer this question