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 9 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

wait(1)
p = game.Players.LocalPlayer
c = workspace.CurrentCamera
rs = game:GetService('RunService')

if not p.Character then p.CharacterAdded:wait() end

h = p.Character.Head
rs.RenderStepped:connect(function()
    if (h.Position - c.CoordinateFrame.p).magnitude >= 14 then
        p.CameraMode = Enum.CameraMode.LockFirstPerson
        p.CameraMode = Enum.CameraMode.Classic
    end
end)

4 answers

Log in to vote
0
Answered by 9 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.

game: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 9 years ago

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

Log in to vote
0
Answered by 9 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 9 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

local cam = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = game.Workspace[player.Name] -- could also be player.Character

while true do
    wait(.1)
    local vector = Vector3.new(cam.CoordinateFrame.x, cam.CoordinateFrame.y, cam.CoordinateFrame.z)
    mag = (char.Head.Position - vector).magnitude -- finds distance from camera to the Head
    if mag > 25 then -- changeable
        script.Parent.Frame.Visible = true -- a frame inside of a ScreenGui that encompasses the screen
    else
        script.Parent.Frame.Visible = false
    end
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.

Answer this question