Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

LocalScript not setting CameraType?

I have a localscript inside of starterplayerscripts, and get the currentCamera, and set the type to Scriptable. But when I enter the game, its set to Custom still (it doesnt error). Here is the code:

	local camera = workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable

doing

	repeat
		camera.CameraType = Enum.CameraType.Scriptable
	until camera.CameraType == Enum.CameraType.Scriptable

doesnt work either. How could I fix this?

Any help appreciated!

2 comments

0

Could be wrong, but I believe its because you are trying to set the camera to scriptable before the character joins and the camera is assigned to them. Try adding a 'Player.CharacterAdded:Wait()' before you set the camera, or repeat wait() until Player.Character

0

thanks! could you put that as an answer to accept?

1 answer

✓ Accepted answer

This answer is entirely by WizyTheNinja, they only put it as a comment though.

I'm doing this not for rep, but so this question can be appeared answered and people won't have to worry about answering it anymore.

"Could be wrong, but I believe its because you are trying to set the camera to scriptable before the character joins and the camera is assigned to them. Try adding a 'Player.CharacterAdded:Wait()' before you set the camera, or repeat wait() until Player.Character" -WizyTheNinja

This discussion is preserved as it was. New answers, comments, and votes are closed.