'Invalid value for enum CameraType'

Trying to set the Camera’s CFrame via Remote Event.

Local Script

function SetCameraPos(object, Status)
	local cam = workspace:WaitForChild("Camera")
	cam.CameraType = Status
	cam.CFrame = object.CFrame
end

--[[local TweenService = game:GetService("TweenService")
local camera = game.Workspace.Camera
local cutsceneTime = 12

local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

function tween(part1, part2, cutsceneTime)
local tweenInfo = TweenInfo.new(
	cutsceneTime,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	0,
	false,
	0
)

	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = part1.CFrame
	
	local tween = TweenService:Create(camera, tweenInfo, {CFrame = part2.CFrame})
	tween:Play()
	
	wait(cutsceneTime)
	
	camera.CameraType = Enum.CameraType.Custom
end

game.ReplicatedStorage.Cutscene.OnClientEvent:Connect(function(startPt, endPt, timeLength)
	tween(startPt, endPt, timeLength)
end)--]]

game.ReplicatedStorage.SetCameraCFrame.OnClientEvent:Connect(function(obj,Stats)
	SetCameraPos(obj, Stats)
end)

Server Script

game.Players.PlayerAdded:Connect(function(plr)
	game.ReplicatedStorage.SetCameraCFrame:FireClient(plr, workspace.Camera1, Fixed)
	wait(5)
	--[[game.ReplicatedStorage.Cutscene:FireClient(plr, workspace.Camera1, workspace.Camera2, 15)
	wait(15)]]--
end)

It says in the output that it’s an invalid value for enum CameraType. Is there anything that I’m doing wrong here? There’s also an orange line under ‘Fixed’ in line 2 of the Server Script. So maybe it has to do with that?

cam.CameraType = Status

Should be

cam.CameraType = Enum.CameraType.TYPE

remove the Arg: “Status” and change TYPE to ur camera type preference

In this case:

cam.CameraType = Enum.CameraType.Fixed

Would be it

Right, but I also wanna run the same remote event to change it to Custom cameratype.

Okay. So where is the Arg: “Status” coming from?

Sending it from the remote event from the server all the way to the func

should we continue in dms to not spam

Try to make Status as two variables in the SetverScript like this:

local StatusFixed = Enum.CameraType.Fixed
local StatusCustom = Enum.CameraType.Custom

Make both those variables an Arg in the ServerScript when u fire the client.

In the LocalScript, instead of a “Status” Arg, carry over the two new Args and put them in the local script.

Then use the ServerScript to switch between both by using

else

Or something similar.

Make sure u change “Status” in the ServerScript to the corresponding Variables.

1 Like

Like this?

local MakeCamScriptable = Enum.CameraType.Scriptable
local MakeCamCustom = Enum.CameraType.Custom

game.Players.PlayerAdded:Connect(function(plr)
	game.ReplicatedStorage.SetCameraCFrame:FireClient(plr, workspace.Camera1, MakeCamScriptable)
	wait(5)
	--[[game.ReplicatedStorage.Cutscene:FireClient(plr, workspace.Camera1, workspace.Camera2, 15)
	wait(15)]]--
end)
game.ReplicatedStorage.typewriter:FireAllClients("This text is for the typewriter tutorial.", 0.05)

(tried this didn’t work)

you can simply replace

cam.CameraType = Status

to:

cam.CameraType = Enum.CameraType[Status]

This should fix your issue

2 Likes

I tried that and it didn’t work…
:thinking:

change cam.CameraType = Status to cam.CameraType = Enum.CameraType[Status] and make Fixed in the server script a string like "Fixed".
Alternatively you could just send "Fixed" or Enum.CameraType.Fixed and leave it as that, as a cameratype doesn’t need to be an enum.

Tried every option and it’s not working. IQ dropping fast.

what is not functioning?
Did you send Status as a string ?

1 Like