Can't set MaxCameraZoomDistance to 50

So I was trying to limit how far the player can zoom out but it won’t set CameraMaxZoomDistance to 50. The script is a LocalScript inside of StarterPlayerScripts.
Here’s the code:
local Players = game.Players
Players.PlayerAdded:Connect(function()
wait(1)
Players.LocalPlayer.CameraMaxZoomDistance = 50
end)

You can use the StarterPlayer‘s properties to change this much more efficiently.

Sorry I forgot to add this to my topic so I will, but the script is a LocalScript inside of StarterPlayerScripts.

What I meant was, StarterPlayer service has properties that you can use to change settings like these. Go to your explorer, press StarterPlayer, then change the settings to your liking. There is no scripting required.