How can i make a Sniper scope

How can i make a zoom in script for weapons. Some Ideas? Is there something like a zoom function ?

1 Like

Cameras have a FieldOfView property, you can decrease this when you want to zoom in, and increase it when you want to stop zooming. One of the examples for the uses of this property in the dev wiki also states that. You can get the current camera of a player in a localscript via workspace.CurrentCamera

“Reducing FOV to give the impression of magnification (for example when using binoculars)”

2 Likes

You could change the Local Player’s Camera FieldOfView property whenever you want to activate the scope, do keep in mind that you’ll need to use a LocalScript since it’s only replicating across your side:

local UIS = game:GetService("UserInputService")
local Player = game.Players.LocalPlayer
local Camera = workspace.CurrentCamera
local SniperKey = Enum.KeyCode.Q

UIS.InputBegan:Connect(function(Input, Chatted)
    if Input.KeyCode == SniperKey then
        Camera.FieldOfView = 70 --Or whatever most snipers do idk
    end
end)
4 Likes

Just so you know, this does not fully work. every time you press any other key, or click, it stops.

edit: When I was in the middle of replying I did not realize that This was two years ago.

edit: I just realized it was my code that caused this, sorry about that.

5 Likes