This script, when placed in a Script and then placed in ServerScriptService does not work. I am confused whether or not I need a LocalScript and where it should be going. If this is the correct place/object, what is wrong with the script? I would like it to force the player into 1st person but not by using a GUI that blocks view when zooming out.
while true do game:GetService('Players').LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson wait(10) end
As stated by Fattycat, it should indeed be ran through a localscript, otherwise it will only work in solo mode. However, earlier I was playing with CameraMode (see this thread) and came across a very unique problem- the CameraMode didn't want to change when the code was ran for the second time (only successfully changing the CameraMode when the player joined, not upon reset.)
This being said, there is a solution to this rather annoying CameraMode issue, and the solution was posted on the thread that I linked earler (it's the last post on the thread.) The solution is to simply change the CameraMode value to "Classic" and then to "LockFirstPerson."
If you want to force first person upon entering and resetting, put the following code in a LocalScript and insert the LocalScript into game.StarterPack
or game.StarterGui
.
local player = game.Players.LocalPlayer player.CameraMode = Enum.CameraMode.Classic wait() -- I don't know if this wait is needed, I haven't tested it, but the person who supplied a solution included a wait (again, see the link posted earlier in this answer) player.CameraMode = Enum.CameraMode.LockFirstPerson
Hope this helps. Feel free to leave a comment if it didn't.
Make sure you put this in a Local Script, since you reference "LocalPlayer" and place into the Player somehow (Easiest method is StarterGui)
Fatty cat already got it down. It's being used for a player, so use local script to allow access of first person only for the player. What you have is right, but use it as local script.
Vote this if it was useful.
I want to thank you guys for the responses, although neither of these seemed to work.
Locked by TheMyrco
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?