So I'm doing a camera GUI idk how to set the camera back to normal with a button.
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent:WaitForChild("Frame").Visible = true repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraPart.CFrame script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent.Parent.Frame.Visible = false end) end) end)
How about try doing this code:
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() local Camera = workspace.CurrentCamera local ToNormal = false script.Parent.MouseButton1Click:Connect(function() if ToNormal == false then ToNormal = true script.Parent.Parent.Parent:WaitForChild("Frame").Visible = true repeat wait() Camera.CameraType = Enum.CameraType.Scriptable until Camera.CameraType == Enum.CameraType.Scriptable Camera.CFrame = workspace.CameraPart.CFrame elseif ToNormal == true then ToNormal = false script.Parent.Parent.Parent.Frame.Visible = false -- then the rest of the code in your second function here end end)
Hope this helps!
If you wanted to set the camera back to deafult, you would neet so set the Camera Subject to the Humanoid, the Camera Type to Custom and the Camera CFrame to the player's head CFrame.
Here is an example:
local Camera = workspace.CurrentCamera local Player = game:GetService("Players").LocalPlayer script.Parent.Mouse1ButtonClicked:Connect(function() Camera .CameraSubject = Player.Character.Humanoid Camera.CameraType = "Custom" Camera.CFrame = Player.Character.Head.CFrame end)
Let me know if this helped you!