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

I need tips on what to research for a Gun zoom?

Asked by 6 years ago

I am making a third person shooter game, and I wanted to know some tips on what to research about a zoom system. Example say your character is just walking around with the gun the default cam and when you press q or rightmouse click your character holds up the gun like there aiming then you see a cross hair. Does anyone have any tips on how to do this or were to learn.

2 answers

Log in to vote
0
Answered by 6 years ago

For the zooming itself, the simplest way is to just decrease the Field of View:

LocalScript in Tool

local camera = workspace.CurrentCamera -- get the camera
camera.FieldOfView = 50 -- (default 70) makes you zoom in

As for raising your arms, you'll want to use an animation. Here's the relevant page from the wiki: http://wiki.roblox.com/index.php?title=Animations

And for having this all happen when you perform an action, check out the UserInputService: http://wiki.roblox.com/index.php?title=API:Class/UserInputService

0
THANK YOU SO MUCH! This is is what im looking for thanks again i appricate this! User#19513 5 — 6y
Ad
Log in to vote
0
Answered by
Galicate 106
6 years ago
Edited 6 years ago

Well for the zoom you can slowly change the field of view.

local camera = game.Workspace.CurrentCamera
local fov = camera.FieldOfView

function aim()
    repeat fov = fov - 1
        wait(0.1)
    until fov = 40
end

script.Parent.Mouse3Down:connect(aim)

for the arms moving, depending on the player type(R15 or R6) you can use animations or CFrame.

Answer this question