If your game is in third person then you don’t need to have a proper aim down sights system, since that’s kinda useless from the third person.
But if I understood right you are making this so that the gun is used in first person view. In which case, you should try making a View Model that only exists on the client, which you can position in the center of the screen and make it look immersive. This is how all the good FPS games do it.
so a great thing to use for viewmodels is the CFrame:Lerp() property since you can create really nice smooth animations with it.
so heres a small snippet of code that only shows the positioning of the viewmodel and how it can be aimed
local gripcframe = CFrame.new(0.4,-0.3,-1) -- position to hold the gun
local aimcframe = CFrame.new(-gripcframe.X,0,0) -- aim offset cframe, Z value is the negated gripcframe.Z Value to return the gun to middle of screen
local aim = CFrame.new(0,0,0)
local aimed = true
local mouse = game.Players.LocalPlayer:GetMouse()
local viewmodel = (ModelHere) --should have a PrimaryPart Set
mouse.Button2Down:connect(function()
aimed = true
end)
mouse.Button2Up:connect(function()
aimed = false
end)
while true do
if aimed = true then
aim = aim:Lerp(aimcframe, 0.3) -- is player is holding down right click, move gun towards
aiming position
else
aim = aim:Lerp(CFrame.new(0,0,0), 0.3) --reverse our aiming affect by bringing the aim cframe to 0
end
game:GetService("RunService").RenderStepped:wait()
viewmodel:SetPrimaryPartCFrame(workspace.Camera.CFrame*gripcframe*aim) -- moving the weapon to be in middle of screen, then editing that by our two cframes (grip and aim, but aim dynamically changes its value with right click/right click up)
end
so this is a great and simple method for making an aim down sights system, but it requires you to use a client ViewModel as WELL as a server model in the characters hands for everyone to see.
This method makes sure that the gun always ends up aligned with the middle of the camera when aiming, and does not require tedious eyeballing to make sure the offset is correct.
If you have any questions message me.
Heres a simple place I made that utilizes this method of Lerping: Streak (Testing) - Roblox