I’m not knowledgeable enough to explain this well, so just bare with me here. What I’m trying to achieve with this is when I press play in the main menu (which I’ve already made in a different script), the camera disables. As you can see I want to repeat until the condition is met, although when I go and test the condition is already met. However I tried to put an If statement, although you can’t put two (operators?) next to each other. When I run this now, it runs an error which I’m aware of but don’t know the to solution to fixing this. Any suggestions or fixes? OOF. (yes I’m a noob haha)
-- 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
Call a function that both sets the frame’s Visible property to false AND does your camera stuff (or whatever else you want it to do).
Use the GetPropertyChangedSignal method to figure out when the frame’s Visible property is set to false and connect the signal the above method returns to a function that does whatever you want.
Tip: You can check multiple statements in one equality by using the or operator. For example, if (visible == false) or (continue == true) then .... No need for parenthesis, but they help with readability.
Simple fix to your problem is using an observer or what’s commonly referred to as a Bindable Event. This would just fire regardless of any script is listening in on this event firing, and with your script that you need to react to the event of
you can listen in on this event fire and respond accordingly which in your case is disabling the camera.