Roblox Weapons Kit Fix

I’ve seen lots of people having problems with Roblox’s Weapons Kit, mostly with its very annoying issue of locking your camera in 3rd person mode and over your shoulder. I’ve seen some fixes for this, but most lead to more issues, leave some unattended, or aren’t very easy to implement. I myself used this kit in one of my old games, so I decided to make a (probably) complete fix for this weapon kit’s system.

Here is the public model of which you can easily add to your game:
Roblox Weapon Kit Fix - Creator Store

This fixes many issues, with big ones such as:

  • Your camera when unequipping the weapons goes back to normal! No FOV, MoveSpeed, or tilt issues either.
  • Fixed issues with not being able to damage R6 rigs or non-player humanoids.
  • Fixed issues with explosion damage not being displayed correctly.
Some of the Code That I Modified
'ServerWeaponsScript' Server Script:
	- Lines 53 - 78 : I removed all of the weapon's if-statements for checking if the WeaponsSystem is already loaded, and just copied their "initializations" to the new "customInitialize()" function.


'ShoulderCamera' Module:
	- Lines 218  219 : 2 new values. 'self.tiltFix' is used to fix a tilt issue when you would unequip your weapon. 
					   'self.forceStop' is used to stop the shoulder camera from activating when the player is dead (and potentially locking themselves in shoulder camera)

	- Lines 309 - 317 : Here is where all the fixing magic happens. I disable all the current "Springs" that smoothly change the camera's FOV and the player's walkspeed.
						I then use some small custom functions to reset their values to the default (so that your walkspeed and FOV will go back to normal)
						
	- Line 553 : Return type 'boolean' added to the function. This helps to fix stuff explained further here.
						
	- Lines 548 - 552 : Prevents an issue for when the player equips a weapon while their joints are broken (AKA: dead), as the
	 					'self.currentWaist = character:WaitForChild("UpperTorso"):WaitForChild("Waist")' line would provide an infinite yield (as there is no 'Waist' joint when the player is dead!)
						This will also return false to let whatever code know that called the function that this is not a valid characterChange.
	
	- Lines 581 - 584 : When the player dies it will call one of my custom functions setForceStop(false) to force the player to not go in shoulder camera mode.
	
	- Lines 243 - 253 : Now that the shoulder camera isn't always active, we have to prevent the camera from still being activated when the player dies (or when they load again they will be locked in it again)
						If the characterChange wasn't valid, we will have to force the player to not go into shoulder camera mode by calling one of my custom functions setForceStop(false).
					
	- Line 820 : One issue I encountered with all of these fixes is that the crosshair would still be active even when we disable the shoulder camera on death (because self.zoomState would be false),
				 causing the crosshair to be set active to 'not false' AKA: true. So one of the main reasons to add self.forceStop is to prevent this and to force the crosshair to not be active on death.
					
	- Lines 1023 - 1043 : Here are those short custom functions to reset the player's values back to normal. You have to pass the value's parameters as for some reason
						 trying to access the self.currentCamera or self.currentHumanoid gives you nil references at that point.
			
			
'WeaponsSystem' Module:
	- Line 185 : The player's camera will now default to regular (which means it will only go into the "Shoulder Camera" when equipping one of the weapons)
	
	- Lines 409 - 415 : Added an if-else statement to disable/enable the Shoulder Camera based on whether or not the weapon was just equipped/unequipped
		
	- Lines 418 - 423 : Fixed an issue with trying to damage humanoids that didn't have their Model have the PrimaryPart set as the HumanoidRootPart
	
	- Lines 503 - 514 : Modified slightly so that explosions will show the correct damage dealt, as previously it would just show the BlastDamage without the distance damage reduction taken into account.
	
	- Line 796: Changed from "UpperTorso" to "HumanoidRootPart" so that it will hurt R6 players + NPCs

'DirectionalIndicatorGuiManager' Module:	
	- Lines 52 - 59 : Now that the players have the ability to not always have a current Shoulder Camera, I had to prevent the code from trying to display a damage
					  indicator to a player who just got hurt by a weapon but doesn't have the Shoulder Camera (or else it would give annoying warnings and errors)

'BaseWeapon' Module:
	- Line 121 : Commented this out as it caused an issue. When a player would join and an existing player had a weapon equipped, it would give the joining player the shoulder cam which is of course not good.
	             The full explanation is commented on the lines behind it.

And that is all! (other than some commented out print statements of which I used for debugging, or probably some small stuff I forgot, which might also mean the line numbers might be slightly inaccurate).

If you find any issues, please tell me and I will try my best to fix it. If you have any QOL ideas, also tell me and depending on how reasonable it is I will add it. Also, if you made your own or found some other assets that work well with the Roblox Gun Kit, tell me and I might add it to the “Add-ons” list.

Other Add-ons
  • Gun Kit Leaderboard Asset | Tracks kills, headshots, deaths, and awards points with the Roblox Weapon Kit weapons. Also has leaderstats and save system.
  • Player Radar | If you have a game with guns, then you might want to have a player radar like in COD or other shooter games! This asset was made by me and comes with lots of customizability and clean code.

Edit: Updates to the kit will be listed in the “READ ME” script of the asset, and I will periodically edit this post to include updated stuff also.

Current Version Number: v1.03

23 Likes

Hi, I am checking this out.

How can I modify it so that none of these change ?

No FOV, MoveSpeed, or tilt issues either.

Thanks

1 Like

I don’t get your question, sorry. Do you want the issues with the FOV, MoveSpeed. and the tilting to stay? This kit fixes those issues.

2 Likes

Thanks for posting this, I have also been messing around with it for some time and this solves many of the problems that I was having.

However, I’ve been trying to allow either a togglable 1st/3rd person or a scrollable camera position by adjusting self.normalOffset (ShoulderCamera) and setting the local player visibility except for their gun (I can share code for this if useful). I have not found a clean / efficient way to toggle the camera position, that remains compliant with all controller methods.

Do you have any thoughts / interest in adding this? Happy to share ideas / tests in DMs if preferred.

I am looking to change it so that the camera is at a 3rd person top down position,

also turning any camera zoom like a sniper right mouse click off.

You could send me some of the code if you wish, I might be able to add it as an optional function that people can choose to use.

I made a sprinting system with stamina, and found that with the normal gun system if i disabled sprinting in config, then my sprint wouldnt work, and if i enabled then the stamina wouldnt work, would this gun kit face the same problems?

I don’t know what your custom code does, so I cannot confirm or deny if it will work.

i don’t usually comment but, I want to say this is very useful for my game thank you.

il let you know if i encouter any Problems :smiley:

2 Likes

Hey! Im really glad i came across this post you made very recently. I’ve been trying to fix the annoying shouldercamera feature for months now. Thanks, I really appreciate this simple model to fit that.

1 Like

Someone can spam FireServer the WeaponHit remote on every player or change the configuration Values on the client, and the visual bullet, some sanity checks would help a lot, but in the current code there is none

1 Like

That’s just how the base kit works, so I have not implemented anything to prevent some of those exploits. Also, I’ve been trying to test your spamming of the WeaponHit event but cannot get it to work with actually having it damage the players. However, if you have any code that can fix this issue I will happily implement it.

i’ve Encountered some issues, when i join the game for the first time it shows me the Crosshair without me having to equip the guns

based on my investigation when there’s a player holding the gun at the time you joined it will glitched like that. Resetting doesnt fix it

1 Like

I delete the weapons system folder in each script. I place the weapon system folder in server script service and the guns still work.

I also edited the scripts to track kills, headshots and give points.

I meant I remove the weapon system folder in each gun. Sorry typing on my cell phone.

can you share a .rbxl of you modifications?

Thanks

Yea, I can send the file tomorrow. I’m in bed now.

1 Like

Here is a RBXM file with the some of the guns, weapon system folder and leaderstats.

Weapons.rbxm (174.6 KB)

Let me know if you have any issues or questions.

2 Likes

I will look into this right now, sorry for the late response.

Edit: Just confirmed this issue, trying to make a fix right now.

I figured out the issue was in the BaseWeapon module on line 113, so I commented it out (and so far I haven’t seen many issues caused from that, so please let me know if more happen!). I updated the kit and provided an explanation on that line of how the issue worked. Thank you for this report!

Here is the explanation if you don’t want to look at the new README for the model:

		if self.instance:IsDescendantOf(workspace) and self.player then
			-- This causes an issue when a new player joins and an existing player is holding out a weapon. It will give the joining player the shoulder cam as it will run
			-- self:setEquipped(true), which calls self:onEquippedChanged(), which calls self.weaponsSystem.setWeaponEquipped(self, self.equipped) (and self.equipped is true),
			-- and then the self.weaponsSystem.setWeaponEquipped(self, self.equipped) function in the WeaponsSystem module will set the camera active as it is "equipped."
			-- But how is this code even running? self.player of course exists and will result in true, but what about self.instance:IsDescendantOf(workspace)?
			-- My best guess is that when another player has the weapon equipped, there will be an instance of this Module inside workspace from that weapon, so there
			-- would be a valid descendant and result in true.
			-- So far commenting out this line has had no effect on anything else, so should be fine?
			
			--self:setEquipped(true)
		end
1 Like