Weapons Kit - Shoulder Camera

Hi all, I am currently using a heavily modified version of the endorsed weapons kit for my game, but I am running into an issue that is also present in the weapons kit files in this thread.

Essentially, when you unequip a weapon while zoomed in, the camera maintains the field of view values it had while zoomed. It is not very noticeable with weapons that have sights (FOV changes from 70->65, which is barely noticeable), but if you try it with a weapon with a bigger ZoomFactor like the Sniper Rifle, then it becomes apparent.

Like I mentioned, this issue is also present in the files previously attached to this thread. Any idea how to fix this?

1 Like

Was actually able to figure this out. Essentially what is happening is the zoomFactor functions are being called correctly, but on unequip the main ShoulderCamera loop is not updating the camera to reflect the updated zoom numbers.

Within ShoulderCamera, there is a function “setEnabled”. If you go into the else statement in this function (which is called when setEnabled is false on unequip), you can add the SpringService line of code so the camera will update with the new zoom factor after unequipping. The code should look like this:

ShoulderCamera.SpringService:Target(self, 0.8, 3, { zoomAlpha = self.zoomState and 1 or 0 })
ShoulderCamera.SpringService:Target(self.currentCamera, 0.8, 3, { FieldOfView = self.desiredFieldOfView })

2 Likes

Here’s a better solution to the character tilting problem…

I wanted to keep the applyRootJointFix() function as the weapon bouncing up and down looks just as bad as the character tilting.

Add a new attribute to the ShoulderCamera constructor: e.g. self.tiltFix, and initialise to nil.

Now, inside applyRootJointFix(), before this line…

self.rootJoint.C0 = CFrame.new(self.rootJoint.C0.Position, self.rootJoint.C0.Position + rotationFix.LookVector.Unit)

add this line, so that we have the original C0 CFrame value stored.

if not self.tiltFix then self.tiltFix = self.rootJoint.C0 end

Now, when the weapon is unequipped, set rootJoint.C0 to the tiltFix CFrame value. For example, I have this line in a LocalScript, connected to the Unequipped event:

weaponModule.camera.rootJoint.C0 = weaponModule.camera.tiltFix
3 Likes

which tilting issue is this referring to?

1 Like

I made a video about this, it includes:

  1. Shoulder camera fixed
  2. With and without FriendlyFire Scripts
  3. Cash per kill

Here’s a link: Roblox Studio | Weapon Kit FREE Model(Camera Bug Fixed, AmmoUI, FriendlyFire, and Cash Per Kill) - YouTube

6 Likes

can someone upload a model with the friendly fire fix? I tried adding a stringvalue on the character but then it just disappears

1 Like