Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stop player from zooming out?

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

2 answers

✓ Accepted answer

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.

1 comment

0

This worked for me thank you! Also thank you to spy guy, it was very close to this.

Dont make it complicated, use the max zoom distance property of the starterplayer service.

wait(0.1)
game.StarterPlayer.CameraMaxZoomDistance = --Put valur here

7 comments

0

whoops, meant value

0

RIP my answer. xD

0

LOL, I beat you tp the punch

0

It doesn't seem to be working, I have it as a normal script under workspace, and for the value I set it to 20. Is there anything that I'm doing wrong?

0

Try actually setting it with the properties tab. Like, in the explorer change it. If that doesnt work you can use mr lonely's method

0

Oh RIP XD

0

Just an FYI, setting game.StarterPlayer will set it for new players that join after that point

This discussion is preserved as it was. New answers, comments, and votes are closed.