I am trying to make an array list that checks if the players name is in the game and if so not to affect their camera but I am quite new to arrays and do not really understand how they work. If someone could help me with this that would be great, the lines that are necessary is line 9 and line 26. The code is down below.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DisableCamAll = ReplicatedStorage:WaitForChild("DisableCamAll")
local CamAll = ReplicatedStorage:WaitForChild("CamAll")
local gui = game.ReplicatedStorage["CamOnDev"]
local cam = workspace.CurrentCamera
local CamPart = game.Workspace.CamPart
Disable = true
local playerlist = {"Eletrinn"}
DisableCamAll.OnClientEvent:Connect(function()
Disable = false
end)
CamAll.OnClientEvent:Connect(function(txt)
Disable = true
local FocusPart = game.Workspace:WaitForChild(txt).UpperTorso
local player = game.Players.LocalPlayer.Name
print("Cam Enabled.")
if player == "Eletrinn" then
game.Players:WaitForChild(player).PlayerGui:WaitForChild("CamOnDev").Frame.Enable.Visible = false
game.Players:WaitForChild(player).PlayerGui:WaitForChild("CamOnDev").Frame.Disable.Visible = true
else
print("You are not Eletrinn")
end
if player == playerlist then
print("Camera Not affected")
else
while Disable == true do
cam.CameraType = Enum.CameraType.Scriptable
cam:Interpolate(CamPart.CFrame, FocusPart.CFrame, 0.5)
wait(0.2)
end
end
end)

1 comment
Thank you for the help, it worked. :)