Hello guys, I have issues when I really wanted to make a GUI button when the player enters the game, their player camera will move to the part camera for the menu, and when the player clicks a GUI button, it will move the player camera from the camera CFrame part to another CFrame part without end time.
Here is the script that I wrote in order for the player to join, the player camera would move to the Part1 CFrame of the camera, if a player clicks the GUI button, the camera would move to Part2 CFrame of the camera, I don’t know what caused it If you guys can correct my code for it to work, maybe my script isn’t working and thus, this is in a LocalScript in a GUI.
Explorer:

LocalScript:
local player = game.Players.LocalPlayer
local character = player.CharacterAdded
local Mouse = player:GetMouse()
local camera = game.Workspace.CurrentCamera
local defaultCframe = camera.CFrame
local view = 50
local debouncesingleplayer = false
function updateCamera()
camera.FieldOfView = 50
camera.CFrame = game.Workspace.Part1.CFrame
end
function updateCamera2()
camera.FieldOfView = 50
camera.CFrame = game.Workspace.Part2.CFrame
end
game:GetService("RunService").RenderStepped:Connect(updateCamera) -- this one is where the player joined, the player current camera would move to the part CFrame camera.
script.Parent.Frame.TextButton.MouseButton1Click:Connect(function()
print("clicked test")
camera.CameraType = Enum.CameraType.Custom
camera.FieldOfView = 70
camera.CFrame = game.Workspace.Part2.CFrame -- this is a part where I wanted to move the part1 cframe camera to the part2 cframe camera
--script.Parent.Frame:Destroy() -- this is a part where the player part camera moves back to the player
--script:Destroy()
end)
It would be appreciated if you guys can correct my scripting error.
so any alternatives?