I Can't set camera StateType

Hello scripters!
I am trying to choose de CurrentCamera State Type, more the camera doesn’t change the StateType, I already looked in the game’s output, I tried to look in the devforum and it didn’t come up with anything.

I’ll make a Local Script in the StarterPlayerScripts.

– Local script in StarterPlayerScripts

local camera = game.Workspace.CurrentCamera

if camera then
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = nil
end

1 Like

Have you tried a line like these?

local RunService = game:GetService("RunService")
local camera = game.Workspace.CurrentCamera

if camera then
	repeat
		RunService.Heartbeat:Wait()
		camera.CameraType = Enum.CameraType.Scriptable
	until camera.CameraType == Enum.CameraType.Scriptable
end
local RunService = game:GetService("RunService")

-- choose either Heartbeat or RenderStepped
(RunService.Heartbeat or RunService.RenderStepped):Connect(function(_)
	camera.CameraType = Enum.CameraType.Scriptable

	...
end)

I tried it both ways, more all of they don’t function, one of them would probably give an error since you put the ‘(…)’

I forgot to tell you, this is a place within a universe, I will show you

image

The ... was just there to say they could be other things within the function, nothing for you to copy.

Maybe put the script in StarterGui and see if it makes a difference? That’s usually where I put any camera manipulation script in.

1 Like

What really happens after you set the camertype? Does it follow your character still?

One thing, too; I did say to choose either Heartbeat or RenderStepped, since it shouldn’t be in parenthesis. An actual example of this script would be more like this:

local RunService = game:GetService("RunService")

RunService.RenderStepped:Connect(function(_)
	camera.CameraType = Enum.CameraType.Scriptable
end)

Thx so much man, finally this worked! This is my first post here, thanks a lot man. :+1:

1 Like

try this script

game.Players.LocalPlayer.CharacterAdded:Connect(function()
    task.wait()
    game.Workspace.Camera.CameraType = Enum.CameraType.Scriptable
    game.Workspace.Camera.CameraSubject = nil
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.