I'm trying to loop cameras for my menu GUI with multiple camera parts, but it won't work, any help please?

local camera = game.Workspace.CurrentCamera
local Player = game.Players.LocalPlayer
local menu = game.Workspace.MenuCamera

local Char = Player.Character or Player.CharacterAdded:Wait()
Char:WaitForChild("HumanoidRootPart").Anchored = true

local function camerastuff()
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = menu.Cam1.CFrame
	wait(2)
	camera.CFrame = menu.Cam1.CFrame
	wait(2)
end

game:GetService("RunService").RenderStepped:Connect(camerastuff)

script.Parent.TextButton.MouseButton1Click:Connect(function()
	camera.CameraType = Enum.CameraType.Custom
	Char:WaitForChild("HumanoidRootPart").Anchored = false
	script.Parent.TextButton:Destroy()
	script:Destroy()
end)

8 comments

0

ur code doesn't run after line 23 lol, its stuck ina while loop. maybe add a break or some condition

0

Ok now I changed it but otherwise it wont let me use more than 1 camera part for my menu

0

no no, u could've kept ur original code, u just needed to add a debounce

0

it looked like u had some sort of debounce system going, u were just using it wrong

0

it wasn't working even when i tried different methods

0

can u edit ur post & add ur original code again, ill help u with the debounce

0

I just worked around it by putting the camera to one cframe and changing the parts cframe around the map

0

alr good job