I'm stuck right now on this script. I want it to not allow the player to exceed a certain camera magnitude. But not just locking first person. This script is probably way off base but I don't know what I'm doing.
wait(.1) game:GetService('Players').LocalPlayer.CameraMode=Enum.CameraMode.magnitude<=40
The easiest way to limit the zoom distance a player can go is using the property on StarterPlayer if you don't want it to change.
Set the property CameraMaxZoomDistance or CameraMinZoomDistance to change the minimum zoom.
If you want to change the zoom distance for the player while they are playing, you can set the property on their player in game.Players
game:GetService("Players").LocalPlayer.CameraMaxZoomDistance = 100 --game:GetService("Players").LocalPlayer.CameraMinZoomDistance = 10
This is the easiest way to set the zoom distance allowed for a player.
If this helped, please accept this as the answer. If it didn't feel free to ask any more questions you have, I would be glad to help. Or if there are any other questions not related to this, I will also answer those. I hope it helped.
Dont make it complicated, use the max zoom distance property of the starterplayer service.
wait(0.1) game.StarterPlayer.CameraMaxZoomDistance = --Put valur here