In my game at the beginning the player's camera is supposed to go to a nice model background and a gui opens up and when the player presses the close button it will close the gui and the camera gets set back to custom. The gui works fine, but the camera does not change to scriptable, here is the code:
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
button.MouseButton1Click:connect(changeButtonPressed)
while open == true do
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
thank you it is working fine now!