I wanted to make a create multiple camera systems but I had issues.
I’ve searched Devfourm but I didn’t find anything helpful, I’m not a scripter but I kind of know how to debug, I’ve tried to change the local names and replace them but it didn’t change anything, I’ve tried adding another camera into the the game but that didn’t work either.
This is my code for the working one:
local Plr = game.Players.LocalPlayer
local Char = Plr.Character or Plr.CharacterAdded:Wait()
local Cam = workspace.CurrentCamera
local function alphabeticalOrder(instance)
local children = instance:GetChildren()
table.sort(children, function(c1, c2)
return c1.Name:lower() < c2.Name:lower()
end)
return children
end
local CamParts = alphabeticalOrder(workspace.InteriorCameras)
local LArrow = script.Parent.LeftArrow
local RArrow = script.Parent.RightArrow
local arrowClickCooldown = false
Char:WaitForChild(“Humanoid”).Seated:Connect(function(isSeated, seat)
if not isSeated or seat.Name ~= "InteriorCameraSeat" then
script.Parent.LeftArrow.Visible = false
script.Parent.RightArrow.Visible = false
script.Parent.BackgroundFrame.Visible = false
Cam.CameraType = Enum.CameraType.Custom
return
end
script.Parent.LeftArrow.Visible = true
script.Parent.RightArrow.Visible = true
script.Parent.BackgroundFrame.Visible = true
Cam.CameraType = Enum.CameraType.Scriptable
Cam.CFrame = CamParts[1].CFrame
local CamNumber = 1
RArrow.MouseButton1Click:Connect(function()
if arrowClickCooldown then return end
arrowClickCooldown = true
if CamNumber == #CamParts then
Cam.CFrame = CamParts[1].CFrame
CamNumber = 1
else
Cam.CFrame = CamParts[CamNumber + 1].CFrame
CamNumber = CamNumber + 1
end
wait(0.1)
arrowClickCooldown = false
end)
LArrow.MouseButton1Click:Connect(function()
if arrowClickCooldown then return end
arrowClickCooldown = true
if CamNumber == 1 then
Cam.CFrame = CamParts[#CamParts].CFrame
CamNumber = #CamParts
else
Cam.CFrame = CamParts[CamNumber - 1].CFrame
CamNumber = CamNumber - 1
end
wait(0.1)
arrowClickCooldown = false
end)
end)
And the one that failed:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local cam = workspace.CurrentCamera
local function alphabeticalOrder(instance)
local children = instance:GetChildren()
table.sort(children, function(c1, c2)
return c1.Name:lower() < c2.Name:lower()
end)
return children
end
local camParts = alphabeticalOrder(workspace.EnviroCameras)
local LArrow = script.Parent.LeftArrow
local RArrow = script.Parent.RightArrow
local arrowClickCooldown = false
char:WaitForChild(“Humanoid”).Seated:Connect(function(isSeated, seat)
if not isSeated or seat.Name ~= "EnviroCameraSeat" then
script.Parent.LeftArrow.Visible = false
script.Parent.RightArrow.Visible = false
script.Parent.BackgroundFrame.Visible = false
cam.CameraType = Enum.CameraType.Custom
return
end
script.Parent.LeftArrow.Visible = true
script.Parent.RightArrow.Visible = true
script.Parent.BackgroundFrame.Visible = true
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = camParts[1].CFrame
local camNumber = 1
RArrow.MouseButton1Click:Connect(function()
if arrowClickCooldown then return end
arrowClickCooldown = true
if camNumber == #camParts then
cam.CFrame = camParts[1].CFrame
camNumber = 1
else
cam.CFrame = camParts[camNumber + 1].CFrame
camNumber = camNumber + 1
end
wait(0.1)
arrowClickCooldown = false
end)
LArrow.MouseButton1Click:Connect(function()
if arrowClickCooldown then return end
arrowClickCooldown = true
if camNumber == 1 then
cam.CFrame = camParts[#camParts].CFrame
camNumber = #camParts
else
cam.CFrame = camParts[camNumber - 1].CFrame
camNumber = camNumber - 1
end
wait(0.1)
arrowClickCooldown = false
end)
end)