Changing camera

This is not changing my camera. The camera goes to a part for about 0.00001 seconds then goes to the player. Why?

I’d please for a source code so we can see what you have wrote.

Well I just C+P’ed it from one of my games now its not working…

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame

@ArticGamerTV, why did the script work in place no.1 but not in place.no2?

Be sure that your script is a local script that is under playerscripts or else it will not run. I’ve went into studio and copied your code into a local script and placed it in starterplayers playerscripts folder and it works fine for me :slight_smile: I hope that helps

it goes to the camera for about 1 second then goes back to my avatar. I do not think there is a script interfering with this.

What is happening when you test it?

So for about a millisecond the camera is at the part then it changes back to the player.

Change the CameraSubject to the part.

Heres the completed script:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CameraSubject = workspace.CameraPart.CFrame	

will that work

CameraSubject requires an Instance. Change it to this and it should work:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CameraSubject = workspace.CameraPart

Now the camera is in a random position :thinking:

The camera is in the Position of the part.

Well it is not in the position of the part.

Can you send a screenshot of where the camera is?

I might be a while, my studio just crashed…

Oh. I am now making an example…

The part:

What I see:

1 Like

Nope, didnt work. Have no idea

Oh, I think I’m beginning to understand the question.

If you are setting the CameraSubject to Instance CameraPart it may not work since CameraSubject only works with the following CameraType Enums: Follow, Attach, Track, Watch and Custom.

Perhaps try forcing the update to happen to the camera by using a loop to keep the camera in place.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Camera = workspace.CurrentCamera

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

while Camera.CameraType == Enum.CameraType.Scriptable do
     Camera.CFrame = workspace.CameraPart.CFrame
end
2 Likes