Basically, I have a first person game, with a spectating function. Once you press the spectate button, your cameramax and min zoom distance changes to 10. Once you close it, a remoteevent fires and it returns to 0.5 on both.
Do it in a Local Script, you dont need to fire a remote to the server to change the CameraZoom of a client. And make sure you are not Incrementing the Min value before Reducing the Max value. Otherwise you are telling to the engine to have a Min of 10 when your current Max is 0.5. So it gets ignored.
Quick silly script you can place in a local script in your player:
local localPlr = game.Players.LocalPlayer
local inOut = false
script.Parent:WaitForChild("TextButton").Activated:Connect(function()
inOut = not inOut
if inOut then
localPlr.CameraMaxZoomDistance = 11
localPlr.CameraMinZoomDistance = 10
else
localPlr.CameraMinZoomDistance = 0.5
localPlr.CameraMaxZoomDistance = 0.6
end
end)
In StarterPlayer, there is a property called “CameraMode” which is usually set to default but you could set it to “LockFirstPerson” to make an FPS camera? Without setting CameraMinZoomDistance? Now you can just set your Camera(Min/Max)ZoomDistance to whatever you want and just toggle between “Default” and “LockFirstPerson”. It’s that simple!