Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Scriptable CameraType immediately switches to custom?

Asked by 4 years ago
-- Roblox Services
local Workspace = game:GetService("Workspace")


-- Variables

local camera = Workspace.CurrentCamera
local cameraType = camera.CameraType
local cameraCframe = camera.CFrame

local classroom = script.Parent
local cameraPositioniongPart = classroom:WaitForChild("CameraPositioningPart")

local normal = Enum.CameraType.Custom
local scriptable = Enum.CameraType.Scriptable

cameraType = scriptable

print(cameraType)

cameraCframe = cameraPositioniongPart.CFrame

The weird thing is, the print statement says that the CameraType is scriptable, but when I print the CameraType in the command bar, it prints Custom.

1 answer

Log in to vote
1
Answered by
qVoided 221 Moderation Voter
4 years ago
Edited 4 years ago

When your character is loaded it instantly changes it to Custom. Also, make sure that script is LocalScript inside the StarterGui

Here is a probably working script:

wait(0.25)

-- Variables

local camera = workspace.CurrentCamera
local cameraType = camera.CameraType
local cameraCframe = camera.CFrame

local classroom = script.Parent
local cameraPositioniongPart = classroom:WaitForChild("CameraPositioningPart")

local normal = Enum.CameraType.Custom
local scriptable = Enum.CameraType.Scriptable

cameraType = scriptable

print(cameraType)

cameraCframe = cameraPositioniongPart.CFrame

Hope this helps! :D

Ad

Answer this question