I wrote this script so when I the user presses a button the camera will go back to custom and the GUI goes away, but when I put them together the camera does not go to scriptable.
player = script.Parent.Parent
c = game.Workspace.Camera
local open = true
local buttonPressed = false
local button = script.Parent.Parent.StarterGui.ScreenGui.Frame.closeScreen
function changeButtonPressed ()
buttonPressed = true
end
while open == true do
button.MouseButton1Click:connect(changeButtonPressed)
if buttonPressed == false then
c.CameraType = "Scriptable"
pos = Vector3.new(-832.984, 12.576, -680.927)
targ = Vector3.new(-562.654, 1.741, -789.89)
c.CoordinateFrame = CFrame.new(pos,targ)
wait(1)
end
if buttonPressed == true then
c.CameraType = "Custom"
open = false
end
end

1 comment
I changed it to the way you said but the camera wont change still