Changing CameraMode not working

i wanted to change the cameramode of a player in an if function in the server scriptservice and i wrote a script for this but it doesn’t work and i don’t know why (there is always a nil error)

		local playerse = game:GetService("Players")
		local player = playerse.LocalPlayer
		player.CameraMode = Enum.CameraMode.LockFirstPerson

It would have to be in a local script.

1 Like

Local scripts wont work in server script service, I would recommend putting it in either starterPlayerScripts, or starterCharacterScripts. Local scripts will also work in StarterBackpack or StarterGui.

To add onto what has been mentioned, if this is done immediately when a player joins, you can jsut click on StarterPlayer and in the properties, I believe there’s a CameraMode property or similar that has a default value of Classic, just click on the dropdown and click on LockFirstPerson.

@Ae_xxie I knew it existed but wasn’t sure of the name, thanks for the insight!

There is. StarterPlayer has a property called CameraMode that you can change before the player joins, so depending on how you are using it, you might not need a script at all.
image

2 Likes