Camera Manipulation Problems

Hi, I’ve been having trouble having the camera turn off after you press play when you’re in the main menu, any suggestions or fixes? Tried for about 45 minutes, same situation is happening. OOF, thanks.

-- Variables --
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local mainFrame = script.Parent

-- Camera --
repeat wait() until mainFrame.Visible == false 

camera.CameraType = "Scriptable"
camera.CFrame = game.Workspace.CamPart.CFrame
2 Likes

This is a syntax error. There needs to be an expression after the until. This is the condition that needs to be met for the loop to break. Do specify information like this next time.

3 Likes

Replace the 9th line with this:

camera.CameraType = Enum.CameraType.Scriptable

And put a wait() after.

You don’t need to do that, it wouldn’t make a difference plus you really shouldn’t be using wait() like this Avoiding wait() and why

Just to clarify, what do you mean by the camera turns off? What does it do exactly?

The code is fundamentally flawed. Simply setting mainFrame.Visible = false is enough.

To implement it in your code:

-- Variables --
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local mainFrame = script.Parent
local pressPlayGui = -- find it in your explorer or make it

-- Camera --
pressPlayGui.MouseButton1Down:Connect(function()
mainFrame.Visible = false
camera.CameraType = "Scriptable"
camera.CFrame = game.Workspace.CamPart.CFrame
end)