Weapons Kit - Shoulder Camera

Found a issue when using the modified script. When unequiping the crossbow (to std camera), whilst moving, the player character tilts 7 to 8 degrees on the heels (client side). Looks bad. Anyway, effectively hollowing or emptying (commenting out) this function in the shoulder camera script as follows (~ line 488), stops this:

function ShoulderCamera:applyRootJointFix()
if self.rootJoint then
–local translationScale = self.zoomState and Vector3.new(0.25, 0.25, 0.25) or Vector3.new(0.5, 0.5, 0.5)
–local rotationScale = self.zoomState and 0.15 or 0.2
–local rootRotation = self.rootJoint.Part0.CFrame - self.rootJoint.Part0.CFrame.Position
–local rotation = self.rootJoint.Transform - self.rootJoint.Transform.Position
–local yawRotation = CFrame.Angles(0, self.yaw, 0)
–local leadRotation = rootRotation:toObjectSpace(yawRotation)
–local rotationFix = self.rootRigAttach.CFrame
–if self:isHumanoidControllable() then
– rotationFix = self.rootJoint.Transform:inverse() * leadRotation * rotation:Lerp(CFrame.new(), 1 - rotationScale) + (self.rootJoint.Transform.Position * translationScale)
–end

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

end

– This function keeps the held weapon from bouncing up and down too much when you move. For me, its okay without it and way better than having the player character become tilted.

5 Likes

Tried for hours to sort this and using a new copy on seeing this thread, The WeaponSystem still must be in the StarterPack directory for my weapons to work right now and that was without any edits.

Players cannot use shift though and I get this in Output…

21:12:54.283 - ActivateCameraController did not select a module. (x2)

Does anyone else need to keep the WeaponsSystem in a weapon for the weapons to work despite no instructions to do so?

2 Likes

Used ‘papa_kupcake’s’ modified script (several posts above), for the crosbow. Found this varient to work in the starterpack or as I am using it, dispensed on purchasing in game. Where it then copies many of the modular scripts to replicated storage. As I recall Robox page on its weapon kit/s talks about placing most of the scripts directly into replicated storage. However this did not work for this crossbow script when I tried it, and have not noticed any problems, with it coping itself into position post launch for mulitple players.

2 Likes

Thanks for this @papa_kupcake it works nicely and I’m now eager to figure out what you did.

Are all the changes you made mentioned above?

I need to update my own branch of the WeaponsSystem which logs damage history for issuing rewards fairly.

2 Likes

Yes, the changes I made are mentioned above, as well as the cause of it being broken. @Thundermaker300 actually provided the main fixes. I simply applied them to Roblox’s updated Weapons System.

3 Likes

Hello, which lines will I have to change? Please show me exactly what you changed! :hugs:

2 Likes

See the 1st reply-post that I made above. I mention what I changed.

1 Like

A fellow programmer (@AstralKingdoms) and I fixed the weapons system up a bit. See below for how to add our fix and what we changed.

  1. Place the modified WeaponsSystem in ReplicatedStorage: WeaponsSystem.rbxm (90.0 KB)
  2. Add any of the desired weapons from the original kit (list on the Weapons Kit hub page)
  3. Once the weapon is added, delete the WeaponsSystem that comes with it, as well as any scripts inside of it (don’t delete anything else).
  4. Add the following script directly inside the tool object: ServerWeaponsScript.rbxm (1.7 KB)
  5. Configure and give the weapons out as desired.

This weapons system fixes the following issues outlined in this post:

  • Shoulder script only applies while the gun is equipped (will force stop it when the gun is unequipped)
  • Camera will not break upon unequipping the tool.

There are still some bugs with it, including…

  • If the tool is deleted from the character model, the shoulder camera will be stuck until a different weapon is equipped, and the animation will be stuck until the character is reloaded. To fix this, just call Humanoid:UnequipTools() and wait a frame before deleting it.
  • If the user unequips the tool (either manually or via :UnequipTools()) while they are scoped in, their walkspeed will remain the scope walking speed (which is slower than the default 16 walking speed). This bug wasn’t discussed in this post, but I discovered it on my own.
35 Likes

sorry to re-ring this, but thank you.

2 Likes

UPDATE

I forgot to mention this in the previous post, however I got a few questions about this so I’d like to elaborate briefly.

Friendly fire/team killing

if you are using my modified kit found in my post above this one, it comes with a system of preventing same “teams” from attacking each other. You can set this up by following these steps.

  1. Create a StringValue called “Role” in every player character that you want to be factored into the team checking (no string value = no team, they can kill anyone and be killed by anyone)
  2. Set the value to anything you’d like. If the value matches other players, they cannot attack each other.

For example, if you’d like Red and Blue teams, you can use the above system by creating the “Role” StringValue in every red player and give it the value of “Red”, and same for the blue team, except with the value of “Blue” instead.

If you’d prefer to use native team objects, you’ll have to experiment with this on your own as I do not use teams in my projects.

19 Likes

Nice i needed something like this. Thanks bro. and right on time as well

6 Likes

I’m having some problems with R6 with this modified version that I didn’t had before, It works perfectly fine in R15 but when I set the game to R6 it breaks.

5 Likes

When I was doing my optimizations, it was never really meant for R6 being provided that this kit is from Roblox which was made for R15 (Animations and such) and we’ve only modified it to be working with R15 at the moment and preventing stuck animations, mouse locking and other issues, apologies!

4 Likes

I know this a little late, but have you figured out how to properly track who killed a player using this kit? There doesn’t seem to be any creator tags relating this anywhere in the kit.

3 Likes

Kill tracking is not included in the original kit (at least not when we forked it), and as such is not included in our modified kit. You’ll have to implement this yourself.

3 Likes

The creator of the weapons kit is @ROBLOX.

3 Likes

I’m pretty sure they’re aware of the original creator and was just asking if our forked kit contains kill tracking.

1 Like

Sorry to bump but after you delete line 185, put a LocalScript in the tool and put

local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local WeaponsSystem = ReplicatedStorage:WaitForChild(“WeaponsSystem”)
local weaponModule = require(WeaponsSystem:WaitForChild(“WeaponsSystem”))
local camera = workspace.Camera
local player = game:GetService(“Players”).LocalPlayer

script.Parent.Equipped:Connect(function()
weaponModule.camera:setEnabled(true)
weaponModule.camera.rotateCharacterWithCamera = true
end)

script.Parent.Unequipped:Connect(function()
weaponModule.camera:setEnabled(false)
weaponModule.camera.rotateCharacterWithCamera = false
camera.CameraSubject = player.Character
weaponModule.normalOffset = Vector3.new(0,0,0)
end)

7 Likes

You can even add 1st person in the guns using this just set the normalOffset thingy to something really less when the guns equipped I have tried it and if u wanna go in advance then you can use UserInputService to enable/disable 1st person when the user presses a key (actually ur gonna change the offset to trick the user lol). Idk how to enable scrolling the camera tho :sweat_smile:

3 Likes

Sorry to re-ring this, but friendly-fire isn’t working. I have made a StringValue with name “Role” and its value to “player”. The Script is inside StarterPlayer > StarterCharacterScripts
Here is the script:

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local role = Instance.new("StringValue", character)
		role.Name = "Role"
		role.Value = "player"
	end)
end)

Thanks

5 Likes