CameraMinZoomDistance is not changing in LocalScript. I don't understand why

Hello. I made a LocalScript that increases the camera’s minimum and maximum zoom distances, however, the minimum value does not change regardless of what I do. The maximum value does change successfully, but the minimum does not. I did not find an answer for this anywhere, and I have no idea what could be causing this. It should be working. Right?

hum.Seated:Connect(function()
	seated = hum.Sit
	seat = hum.SeatPart
	storage.Events.LooseCamera:Fire()
	if seated == true then
		cam.CameraSubject = seat.Parent.Camera
		cam.CameraType = Enum.CameraType.Attach
		ui.Enabled = true
		mouse.Icon = "http://www.roblox.com/asset/?id=6587131268"
		player.CameraMinZoomDistance = 80
		player.CameraMaxZoomDistance = 96
	else
		cam.CameraSubject = hum
		ui.Enabled = false
		player.CameraMinZoomDistance = 8
		player.CameraMaxZoomDistance = 16
	end
end)

I even checked to see what the values were on the Players service and only the maximum value was changing. The minimum value was still at 8, the default value for my game.

By the way, the value is not being changed by any other scripts.

I still cannot get it to work. What would be the potential reasons for this to be failing? I don’t get any errors in the output, and the strange part is that the MaxZoomDistance is changing.

Try changing the ordering: set the max before setting the min. Otherwise Roblox will cap the min at the current max, then set the new max (which would have allowed for the desired min zoom).

It is weird that the min is stuck at 8 though: the result from the script should be that the min is stuck at 16.

2 Likes

Your point makes a lot of sense and your proposed solution worked just as it should. I changed the ordering as you suggested and now the camera’s minimum and maximum values have changed. Thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.