I have made 2 scripts in StarterPlayerScripts;
View1:
local Players = game:GetService(“Players”)
local RunService = game:GetService(“RunService”)
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local CAMERA_DEPTH = 24
local HEIGHT_OFFSET = 2
local function updateCamera()
local character = player.Character
if character then
local root = character:FindFirstChild(“HumanoidRootPart”)
if root then
local rootPosition = root.Position + Vector3.new(0, 0, HEIGHT_OFFSET)
local cameraPosition = Vector3.new(rootPosition.X, rootPosition.Y, CAMERA_DEPTH)
camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
end
end
end
RunService:BindToRenderStep(“SideScrollingCamera”, Enum.RenderPriority.Camera.Value + 1, updateCamera)
View2:
local Players = game:GetService(“Players”)
local RunService = game:GetService(“RunService”)
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local CAMERA_DEPTH = 24
local HEIGHT_OFFSET = 2
local function updateCamera()
local character = player.Character
if character then
local root = character:FindFirstChild(“HumanoidRootPart”)
if root then
local rootPosition = root.Position + Vector3.new(0, 0, HEIGHT_OFFSET)
local cameraPosition = Vector3.new(rootPosition.X, rootPosition.Y, CAMERA_DEPTH)
camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
end
end
end
RunService:BindToRenderStep(“SideScrollingCamera”, Enum.RenderPriority.Camera.Value + 1, updateCamera)
They both work fine when I enable them seperately, however I want to make it so that when a non colide part is walked through, they will toggle and/or switch between each other so the camera view will change from one side’s view to the other. I tried using chatgpt to help me do this since im not great at scripting but thothing I tried would work. Pls help me