Enum.CameraType.Custom not working properly

Hey there! I have a local script that changes the players camera to a part, and I am trying to make a play button that once clicked, it changes the players camera back to the default one. I have been trying to use Enum.CameraType.Custom. For some reason, I can’t seem to get it to work. I have provided the local script below. It would be amazing if somebody from the community would be able to help me out here. Thank you in advance!

local Player = game.Players.LocalPlayer
local TweenService = game:GetService("TweenService")
local RunService = game:GetService("RunService")
local Camera = game.Workspace.CurrentCamera
local MenuCameras = game.Workspace.MenuCameras
local Mouse = Player:GetMouse()
local StarterGUI = game:GetService("StarterGui")
local AmericaButton = script.Parent.TeamsFrame.America

StarterGUI:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)

local AmericaButton = script.Parent.TeamsFrame.America
local UKButton = script.Parent.TeamsFrame.UK

RunService.RenderStepped:Connect(function()
	Camera.CFrame = MenuCameras.Camera1.CFrame
end)

AmericaButton.MouseButton1Click:Connect(function()
	wait(0.2)
	Camera.CameraType = Enum.CameraType.Custom
end)
1 Like

Using the camera type Scriptable is needed otherwise the camera’s position cannot be changed via code, it’ll be locked onto whatever its subject is.

Custom means the player is capable of controlling the camera’s zoom, rotation, etc.

1 Like

I also tried using Camera.CameraType = Enum.CameraType.Scriptable and it still didn’t do anything.

Can you show me an example of what you mean?

Try replacing the code below

local UpdatingCamF = nil
UpdatingCamF = RunService.RenderStepped:Connect(function()
	Camera.CFrame = MenuCameras.Camera1.CFrame
end)

AmericaButton.MouseButton1Click:Connect(function()
	wait(0.2)
	UpdatingCamF:Disconnect()
	UpdatingCamF=nil
	Camera.CameraType = Enum.CameraType.Custom
	Camera.CameraSubject = Player.Character:WaitForChild("Humanoid")
end)
2 Likes

Thank you so much, that worked!

No problem! I would recommend adding a debounce on the button so it isn’t spammed.

It can’t be spammed as the buttons disappear right away after being clicked. It is just running from a different location. Thanks anyways!