Camera not changing back to custom

I am trying to make a custom camera be activated when entering a store and then get disabled when leaving. I can activate the custom camera but then I can’t change the camera type back to custom even after disabling the custom camera script. I’ve looked around for some solutions but nothing that I’ve tried has worked.

The code that does this is a script in a door that gets activated by a Proximity Prompt.

script.Parent.Triggered:Connect(function(plr)
	local fade = plr.PlayerGui.fade.Frame
	local text = plr.PlayerGui.fade.Frame.TextLabel
	local loading = plr.PlayerGui.fade.Frame.load
	while fade.Transparency > 0 do
		fade.Transparency -= 0.05
		text.TextTransparency -= 0.05
		loading.ImageTransparency -= 0.05
		wait(0.01)
	end
	plr.Character.HumanoidRootPart.CFrame = CFrame.new(workspace.tpUpgradesOut.Position)
	game.Workspace[plr.Name].LocalScript.Disabled = true
	local cam = game.Workspace.Camera
	cam.CameraType = Enum.CameraType.Custom
	wait(0.5)
	while fade.Transparency < 1 do
		fade.Transparency += 0.05
		text.TextTransparency += 0.05
		loading.ImageTransparency += 0.05
		wait(0.01)
	end
end)
1 Like

When you change the camera’s position (when the camera animation plays), do you set the CameraType to Scriptable? And also, is there any errors?

1 Like

Yes the camera changes to scriptable and there aren’t any errors

1 Like

Did you try to add prints everywhere on your scripts to detect where it stopped?

1 Like

The script never stops. It finishes the loading screen.

1 Like

Interesting…

Could you provide me with a video showcasing the script so I can have a look?

1 Like

Shouldn’t this be?:

local cam = workspace.CurrentCamera

You are defining the Studios Current Camera, which is visible in the explorer tab under the workspace instance.

1 Like

I just tried that and still nothing. Also here’s that video. (sorry for taking so long I don’t have good upload speed)

https://youtu.be/a7sWQ93yxbY

Obs had really big file sizes so I had to upload it to youtube.

1 Like

Are you using a custom script to make the camera’s movement?

1 Like

Yes. I have the script in the startercharacterscripts folder.

1 Like

Can you show me the custom script? That might be what is the problem.

Sure.

local cam = workspace.CurrentCamera

local char = script.Parent
local hrp = char:WaitForChild("HumanoidRootPart")


cam.CameraType = Enum.CameraType.Scriptable


local cameraPart = Instance.new("Part")
cameraPart.Transparency = 1
cameraPart.CanCollide = false
cameraPart.Parent = workspace

cameraPart.CFrame = CFrame.new(hrp.Position + Vector3.new(10, 30, 0), hrp.Position)


local bp = Instance.new("BodyPosition")
bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
bp.Parent = cameraPart


game:GetService("RunService").RenderStepped:Connect(function()

	bp.Position = hrp.Position + Vector3.new(10, 30, 0)

	cam.CFrame = cameraPart.CFrame
end)

I’m not sure, but this could possibly have an impact on the CameraType constantly switching to Scriptable.

Whatever is being done in this script stops because it disables the script before going back to custom so it shouldn’t be changing it back to scriptable.

Do you re-enable the custom camera script after leaving the room?

(Nevermind you just responded to me but I didn’t read all of the message)

I have fixed the issue by using a remote event that triggers a local script to change the camera back to custom.