Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Stop player from zooming out?

Asked by 6 years ago

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

Log in to vote
0
Answered by 6 years ago

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.

0
This worked for me thank you! Also thank you to spy guy, it was very close to this. noob1126 34 — 6y
Ad
Log in to vote
1
Answered by 6 years ago

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

wait(0.1)
game.StarterPlayer.CameraMaxZoomDistance = --Put valur here
0
whoops, meant value User#17125 0 — 6y
0
RIP my answer. xD MrLonely1221 701 — 6y
0
LOL, I beat you tp the punch User#17125 0 — 6y
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? noob1126 34 — 6y
View all comments (3 more)
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 User#17125 0 — 6y
0
Oh RIP XD User#17125 0 — 6y
0
Just an FYI, setting game.StarterPlayer will set it for new players that join after that point MrLonely1221 701 — 6y

Answer this question