Hey eveyone, sorry for the dumb question but i am having some difficulties right now with my code, I want to have a loop break once the boolean value updates, here is the script:
local MenuOver = script.Parent:WaitForChild("MenuOver")
MenuOver.Value = false
print("Menu Over is ", MenuOver.Value) -- This prints successfully
PlayBtn.MouseButton1Click:Connect(function()
MenuOver.Value = true
SlideInSide:Play()
print("Menu Over is ", MenuOver.Value) -- This also prints correctly
end)
Here is the issue here, i want the loop here to break once the value changes, how do i do that?
while MenuOver.Value == false do
Cam.CFrame = CamPoints:FindFirstChild("1").CFrame
TweenCameraPos(CamPoints:FindFirstChild("2"), 4)
wait(4)
Cam.CFrame = CamPoints:FindFirstChild("3").CFrame
TweenCameraPos(CamPoints:FindFirstChild("4"), 4)
wait(4)
Cam.CFrame = CamPoints:FindFirstChild("5").CFrame
TweenCameraPos(CamPoints:FindFirstChild("6"), 4)
wait(4)
Cam.CFrame = CamPoints:FindFirstChild("7").CFrame
TweenCameraPos(CamPoints:FindFirstChild("8"), 4)
wait(4)
Cam.CFrame = CamPoints:FindFirstChild("9").CFrame
TweenCameraPos(CamPoints:FindFirstChild("10"), 4)
wait(4)
if MenuOver.Value == true then
Cam.CameraType = Enum.CameraType.Follow
Cam.FieldOfView = 70
break
end
end
Thanks!

4 comments
It worked! Thanks, can you help me understand what this code does?
What I did is I made a for loop that went through every number 1 to 10 instead of writing out 1,2,3,4,5,6,7,8,9,10, the script does that with the for loop.
Don't use FindFirstChild and assume it returns something because it doesn't always return something.
This isn't using FFC's second argument as a number. It's using TweenCameraPos's second argument as a number, I just rewrote his code and did what he wanted.