Camera type not going back to normal after being changed

I have a script that moves the camera around only if it is in scriptable mode, otherwise it doesn’t, but if i change the cameratype to anything else the camera just stays in the last position and orientation it was scripted and doesn’t move, if I change it to scriptable mode it resumes as normal.

Can You Please show the script.

1 Like

Hey. That is actually a normal behavior, as the other “modes” are basically preset scripts, which overwrite all other scripts you try to use on the camera.

1 Like
--Get service needed for events used in this script
local RunService = game:GetService("RunService")	

-- Variables for the camera and player
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
player.CharacterAdded:Wait()
-- Constant variable used to set the camera’s offset from the player
local CAMERA_OFFSET = player.Character:WaitForChild("CameraOffset").Value
print(CAMERA_OFFSET)
camera.CameraType = Enum.CameraType.Scriptable

local function onRenderStep()
	-- Check the player's character has spawned
	if player.Character then
		if camera.CameraType == Enum.CameraType.Scriptable then
		local CAMERA_OFFSET = player.Character:WaitForChild("CameraOffset").Value
		local playerPosition = player.Character.HumanoidRootPart.Position
		local cameraPosition = playerPosition + CAMERA_OFFSET

		-- make the camera follow the player
			camera.CoordinateFrame = CFrame.new(cameraPosition, playerPosition)
		end
	end
end
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, onRenderStep)

this is the script

If so, then how can I get the other scripts to work once the camera type changes again?

They should automatically restart.

1 Like

Hmm, that’s weird, do I have to disable the camera script for them to restart appropiately?

I believe that you don’t. Also, just for preventing weird behavior, check if the CameraType is scriptable inside the function.

1 Like

Yeah that’s what im doing, so the script is still running, just not actively setting the camera’s CFrame property. I just tried deleting the script and the camera remains fixed regardless of type.

1 Like

And I disabled the script and the camera just stays at 0,0,0 now

Why did you disable it lol? Also, change it to follow.

1 Like

I found that the problem was that since the script had Camera in its name that disabled every other camera related script.

1 Like

Ah I see. I had encountered the same error in the past.

1 Like