How can I make an Aiming Script for a Gun?

Issue
I am having trouble making an Aiming script for a Pistol I’ve made. I have an Aim Part and Handle for my Gun, I’m just not sure how to approach scripting the Aim function.

What I’ve Tried
I have been searching this up a lot to find answers, however they all linked to this one thread which had no help.

My Gun Layout
https://gyazo.com/907b28baa6deae89a77eb9544464f310

3 Likes

You can try tweening the FieldOfView property of the camera to zoom in and out

1 Like

I worded what I was trying to say wrong. I’m trying to manipulate the Camera in some way to make it be the CFrame of the AimPart’s CFrame.
(I didn’t mean Zoom in and out)

For a nice zoom in/out effect, you can try using CFrame:lerp to tween the camera to the CFrame.

local s = camera.CFrame
local rs = game:GetService("RunService").RenderStepped

for i = 0, 100, 10 do
    camera.CFrame = s:lerp(aimPart.CFrame, i/100)
    rs:Wait()
end
6 Likes

looks good, but how do you stop it from aiming?