Hello, I’m trying to make a gun system without using a viewmodel, and one of the problems I’m facing is trying to make aiming. I plan on adding attachments, so I don’t want to have to make animations for each attachments, and instead am using an AimPart placed at the sights’ position.
What do you want to achieve? Keep it simple and clear!
I want to make the gun’s aim part to center with the camera and the rest of the model and arms follow, so I don’t have to make unique animations for aiming.
What is the issue? Include screenshots / videos if possible!
In my current code, the gun only moves slightly inward and the character will not look down the sights. I’m pretty new to scripting, so I can’t really find the issue.
Example of aiming a gun without an animation: (it should be looking down the sights)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried looking for solutions and checked through the devforum, but most lead to tutorials on how to make a viewmodel gun system, the problem being I don’t use a viewmodel, so the same solutions won’t exactly work for me.
What I did when I had this issue was fairly simple. I basically made a CFrame variable which would move my entire viewmodel around depending on the variable. In your case, you wouldn’t be using a viewmodel, so you would just make the variable control your arms and gun’s CFrame
For example, when my variable was something like CFrame.new(0, 1, 0), my viewmodel would be 1 stud above where it normally is. I perfectly aligned the CFrame variable with the camera using this line of code:
-- Name of my CFrame variable is called CameraOffset
CameraOffset = Gun.AimPart.CFrame:Inverse() * Gun.PrimaryPart.CFrame
Gun.AimPart is an invisible part on the gun which the camera will be aligned with. Ideally, you want this part to be perfectly aligned down the sight of the gun. Gun.PrimaryPart is an invisible part on the viewmodel which is where the camera is normally (while i’m not aiming down sights)
I tried doing this and it ended up with the same result I was having with my original code.
My “Camera Offset” has already been the same technique, it’s multiplied with the rest of the arm, and if I set it to CFrame.new(0,1,0), the model+arms would be 1 stud upwards.
It seems that you also asked me to create a “Primary Part” which would be where the camera would be when I’m not aiming, but I am confused as to what that means exactly.
As the camera isn’t a moving part, creating a part that is at the camera’s position would be no different than just referring to the camera.