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

Camera zoom out limit help?

Asked by 10 years ago

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

01wait(1)
02p = game.Players.LocalPlayer
03c = workspace.CurrentCamera
04rs = game:GetService('RunService')
05 
06if not p.Character then p.CharacterAdded:wait() end
07 
08h = p.Character.Head
09rs.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
14end)

4 answers

Log in to vote
0
Answered by 10 years ago
  1. There is no such thing as Classic Camera.
  2. It's actually CameraType.
  3. We can change the player's max zoom distance.

This is basically how we do it.

1game:GetService("Players").Player1.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.

Ad
Log in to vote
2
Answered by 10 years ago

Another thing that you could do is modify StarterPlayer's CameraMaxZoomDistance and CameraMinZoomDistance

Log in to vote
0
Answered by 10 years ago

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.

Log in to vote
-1
Answered by 10 years ago

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

01local cam = game.Workspace.CurrentCamera
02local player = game.Players.LocalPlayer
03local char = game.Workspace[player.Name] -- could also be player.Character
04 
05while true do
06    wait(.1)
07    local vector = Vector3.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
14end

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.

Answer this question