Hey, I can not find any good zoom out limit scripts like the one in Apocolypse rising.
Here is one for example, but the problem is when you zoom out your screen bounces. I understand why it does that though, it changes the camera mode to firstperson then changes back into the classic one. I need one which doesnt bounce, could be possibly by somehow making a magnitude limit. Thanks
Here is the script i'm talking about
01 | wait( 1 ) |
02 | p = game.Players.LocalPlayer |
03 | c = workspace.CurrentCamera |
04 | rs = game:GetService( 'RunService' ) |
05 |
06 | if not p.Character then p.CharacterAdded:wait() end |
07 |
08 | h = p.Character.Head |
09 | rs.RenderStepped:connect( function () |
10 | if (h.Position - c.CoordinateFrame.p).magnitude > = 14 then |
11 | p.CameraMode = Enum.CameraMode.LockFirstPerson |
12 | p.CameraMode = Enum.CameraMode.Classic |
13 | end |
14 | end ) |
This is basically how we do it.
1 | game:GetService( "Players" ).Player 1. CameraMaxZoomDistance = 14 --You can change this |
Also, put you script in a code block. BTW the above script is an example. Work off this. The above script could be a regular or local script. We do not need a gui or anything. It's really simple.
Another thing that you could do is modify StarterPlayer's CameraMaxZoomDistance
and CameraMinZoomDistance
Thanks guys I appreciate it. I'm in the midst of learning to script, i can understand it and edit it but i struggle with writing it.
I made my own blocker with a Gui, so that it wouldn't lock the user's mouse when they zoomed out too far.
THIS IS IN A LOCALSCRIPT
01 | local cam = game.Workspace.CurrentCamera |
02 | local player = game.Players.LocalPlayer |
03 | local char = game.Workspace [ player.Name ] -- could also be player.Character |
04 |
05 | while true do |
06 | wait(. 1 ) |
07 | local vector = Vector 3. new(cam.CoordinateFrame.x, cam.CoordinateFrame.y, cam.CoordinateFrame.z) |
08 | mag = (char.Head.Position - vector).magnitude -- finds distance from camera to the Head |
09 | if mag > 25 then -- changeable |
10 | script.Parent.Frame.Visible = true -- a frame inside of a ScreenGui that encompasses the screen |
11 | else |
12 | script.Parent.Frame.Visible = false |
13 | end |
14 | end |
So if the person zoomed out far enough that their camera was x (in this case, 25) studs from their character, it would block it with a screen gui.