Weapons Kit - Shoulder Camera

Um yea I have this problem on my fps game I working on. I think the camera bugs out when this Yield happens but if it doesn’t then the guns work as intended.

1 Like

Are you using R6 avatars for your game? The Roblox Weapons Kit doesn’t support R6 as well as R15, and I get similar errors to yours when I use R6 avatars in my game.

2 Likes

Yes I was, but I forgot about this post lol

2 Likes

Sorry for bumping this but,

Is there a way to entirely remove the shoulder camera?

UNFORTUNATELY; This apparently is not possible, after a bit of searching, apparently it’s only for battle royale games. Hopefully Roblox will make a better one soon.

4 Likes

it’s not “only for battle royale games” there’s nothing tying it to a genre, it’s just a locked 3rd person follow cam. You can remove it but you’d have to make a lot of changes to the code and weapon libraries to not rely on the shoulder camera- not a small effort.

1 Like

A lot of people have done that, including me.

I’ve removed everything that relates to it and it just stops working

2 Likes

that’s my point- you can’t simply remove the camera code and replace it with nothing, because all of the weapons utilize the specific camera module- so you would need to add a lot of NEW code to make the weapons system work independent of the specific camera implementation. It’s not an easy task at all.

2 Likes

Sorry to bump this in late, but Friendly Fire/Team Killing does not seem to work. I tried adding string values in every player character, which did work, but I could still kill my teammates. There were only 2 methods that gave the string values in every player character, and here are the scripts:
Method 1 (ServerScriptService):

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local RedColor = BrickColor.new("Really red")
		local BlueColor = BrickColor.new("Toothpaste")
		
		if plr.TeamColor == RedColor then
			local RedString = Instance.new("StringValue", char)
			RedString.Name = "Role"
			RedString.Value = "Red"
			
		elseif plr.TeamColor == BlueColor then
			local BlueString = Instance.new("StringValue", char)
			BlueString.Name = "Role"
			BlueString.Value = "Blue"
		end
	end)
end)

Method 2 (StarterCharacterScripts):

local Teams = game:GetService("Teams")
local RedTeam = Teams.RedTeam
local BlueTeam = Teams.BlueTeam

local RedColour = BrickColor.new("Really red")
local BlueColour = BrickColor.new("Toothpaste")

for _, redPlr in pairs(RedTeam:GetPlayers()) do
	local redChar = redPlr.Character
	
	if redPlr.TeamColor == RedColour then
		local RedString = Instance.new("StringValue", redChar)
		RedString.Name = "Role"
		RedString.Value = "Red"
	end
end

for _, bluePlr in pairs(BlueTeam:GetPlayers()) do
	local blueChar = bluePlr.Character
	
	if bluePlr.TeamColor == BlueColour then
		local BlueString = Instance.new("StringValue", blueChar)
		BlueString.Name = "Role"
		BlueString.Value = "Blue"
	end
end

I’m really not sure if i did something wrong, because I can see the string value in the character with the correct name and value. I’ve been struggling with this for a while now. Any help is appreciated.

5 Likes

@DevRelationsTeam
I love to see how much time the Community is spending to debug and optimize these features.
What I find disheartening is the fact that Roblox seems to be absent in this process.

The result is one of the most inefficient, anti-patterns of modern programming:
Multiple parties create a variety of parallel home grown solutions which are never merged into the main branch.

If we all adopt @Thundemaker 's solution, what happens when Roblox revs their branch?

It would be really great to see some git-like process where specific Issues are identified, tracked, resolved, and merged into the main branch at Roblox HQ.

This would, of course, require a layer of management to consolidate and track the issues, but this is what modern companies do, and what make them efficient. These Community members are making your product better for free. It’s worth the expense to extend the same source code control tools to them that you use internally.

Does this process exist, and I just don’t know about it?
For example, is there some public facing Feature Request queue that captures the fact that Roblox is working on a Shoulder Camera solution? If so, that would help sync the efforts of Roblox and the Community.

8 Likes

they did not finish the teamkill function from what I saw, or at least did not code it to be compatible with any common definition of teams- under the weaponsSystem script find the function "WeaponsSystem.playersonDifferentTeams- here you will need to modify the code to check if player1 and player 2 are on different teams per your specific implementation of teams. Even after you fix this there may be one type of damage (Explosion splash damage) that still doesn’t run through this function…I forget, but I had to make a number of changes to truly fix the teamkilling using this kit.

4 Likes

Could you please be more specific in the way of how to fix the teamkilling issue?

2 Likes

I would suggest making your own weapons instead of using these. Making some simple guns is easy as hell, believe me. Plus you would have full control over how they work, and you can change anything anytime.

2 Likes

There does seem to be a tagHumanoid function inside the WeaponsSystem module, you would just need to make a separate server script to detect when a humanoid dies and if they have a creator tag on them.

1 Like

I would anyway recommend making your own gun system over these kind of fancy guns. Its very easy, believe me! You would waste more time in fixing these guns rather than making your own.

I made the changes recommended here and for the most part the camera now works with and without a weapon being equipped. One situation that is still glitchy is when you try to drive a vehicle (such as the Roblox Dune Buggy). If you enter the driver’s seat while you have a weapon equipped the result is not good. Any suggestions on how to fix this? I would think you would just want to unequip the weapon when you enter the vehicle.

Just unequip any tool that is currently equipped when a player enters a vehicle using Humanoid:UnequipTools().

2 Likes

I modified this function in the WeaponsSystem ModuleScript to keep players on the same team from shooting each other:

function WeaponsSystem.doDamage(target, amount, damageType, dealer, hitInfo, damageData)
	if not target or ancestorHasTag(target, "WeaponsSystemIgnore") then
		return
	end
	if IsServer then
		if target:IsA("Humanoid") and dealer:IsA("Player") and dealer.Character then
			local dealerHumanoid = dealer.Character:FindFirstChildOfClass("Humanoid")
			local targetPlayer = Players:GetPlayerFromCharacter(target.Parent)
			-- Jaxxon Jargon: added check so players on the same team can't kill each other.
			if WeaponsSystem.playersOnDifferentTeams(dealer, targetPlayer) then
				if dealerHumanoid and target ~= dealerHumanoid and targetPlayer then
					-- Trigger the damage indicator
					WeaponData:FireClient(targetPlayer, "HitByOtherPlayer", dealer.Character.HumanoidRootPart.CFrame.Position)
					targetPlayer.Character.Humanoid:TakeDamage(amount)
				end
			end
		end

		-- NOTE:  damageData is a more or less free-form parameter that can be used for passing information from the code that is dealing damage about the cause.
		-- .The most obvious usage is extracting icons from the various weapon types (in which case a weapon instance would likely be passed in)
		-- ..The default weapons pass in that data
		local handler = _damageCallback or _defaultDamageCallback
		handler(WeaponsSystem, target, amount, damageType, dealer, hitInfo, damageData)
	end
end

You’ll also need to modify the following function:

local function _defaultGetTeamCallback(player)
	return player.Team or 0
end

Let me know if this works for you or not.

3 Likes

Working perfectly! Thanks you :smiley:

How can I activate friendly fire? so that a team can kill each other?

not sure I follow your question- I think it ignores teams and allows you to damage everyone by default. if you want to have both options, then after you implemented the fix to not hurt teammates, you’d probably add a variable “friendlyFire” that is either true or false and add it as a check in the “playersOnDifferentTeams” function. Then you’d need some GUI to toggle/set the value of that variable