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

Camera Angles/Zoom help?

Asked by 10 years ago

I am trying to make a script where the camera is always zoomed in all the way for the whole entire game. I got this script from the wiki but it does not work.

local target = workspace.Part
local camera = workspace.CurrentCamera
camera.CameraSubject = target
local angle = 0

while wait() do
    camera.CoordinateFrame = CFrame.new(target.Position)
    * CFrame.Angles(0, angle, 0)
    * CFrame.new(0, 0, 0)
    angle = angle+ math.rad(1)
end

2 answers

Log in to vote
-1
Answered by 10 years ago

That script you have there makes the player's camera spin around a certain part named "Part," helpful for a main menu screen but not what I think you're wanting. By "zoomed in all the way the whole game" I assume you mean either keeping the player locked to first person mode or keeping the player's camera close to their character. The first option is very simple, needing only a single line: game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson. The second option is a little bit longer but has it's benefits.

local player = game.Players.LocalPlayer

player.CameraMaxZoomDistance = 20
--changes how far out the player can zoom

player.CameraMinZoomDistance = 10
--Useful for when you want the camera always close to the player, but never in FP mode

THE THING TO NOTE about both of these options and the script you listed from the wiki is they MUST be in a LocalScript since they run on the player's computer and therefore understand what a LocalPlayer or CurrentCamera is. By the way Darius, that script is an old hack-ish way of keep the players from zooming out. Some devs still use it, but the above methods have worked far better from my experience.

Ad
Log in to vote
0
Answered by 10 years ago

Here you go. The zoom in to play script :)

local Cam = game.Workspace.CurrentCamera if script.Parent.Parent.className == "Player" then connection = script.Parent.Parent.Parent.Chatted:connect(function (msg) if msg:lower() ~= "quit/" then return end script.Parent.Parent.Character = nil end) end

while true do wait() if (Cam.focus.p - Cam.CoordinateFrame.p).magnitude > 1 then script.Parent.Blind.Visible = true end if (Cam.focus.p - Cam.CoordinateFrame.p).magnitude <= 1 then script.Parent.Blind.Visible = false end end

Answer this question