Gun system players accessories blocking gun shots (its not letting me shoot it or make a damage)

Whenever I shoot a player or even a dummy accessories it blocks the gun shots and not go through but if i shoot at body it shoots normally

The gun system can shoot the head if there was no accessories

6 Likes

still looking for help^^^^^^^^^^^^

1 Like

When the raycast hits a hat, add a if statement for if the RaycastResult.Instance’s parent or itself is an Accessory. Or you can add every player’s hat in the game to be excluded in the Raycast paramaters.

4 Likes

Look through accessories and add their handles to a blacklist, here’s a little part from my projectile module that deals with that problem.

local bullet = game.Lighting.Bullet:Clone()
local blacklist = { client.Character, viewmodel, bullet }

	for _, players in pairs(game.Players:GetPlayers()) do
		if players.Character then
			for _, acc in pairs(players.Character:GetChildren()) do
				if acc:IsA("Accessory") then
					table.insert(blacklist, acc.Handle)
				end
			end
		end
	end

BlackListParams.FilterDescendantsInstances = blacklist

local resultRay = workspace:Raycast(bullet.Position, bullet.CFrame.LookVector * Speed * 7, BlackListParams)
3 Likes

I can give you the gun system copy so you can check it out

1 Like

I can give you a copy of the gun system

1 Like

I’m new to raycasting and not knowledgeable about them

Sure. Ill do it for ya.

bbbbbbbbbbbbbbbbbbbbbb

1 Like

Tysmm
gunsystem2.rbxl (352.0 KB)

1 Like

Inside your GunHandler Module, change the

--params for caster
	local castParams = RaycastParams.new()
	castParams.IgnoreWater = true
	castParams.FilterType = Enum.RaycastFilterType.Exclude
	castParams.FilterDescendantsInstances = blacklist
		

For

--Blacklist Accessories
	local blacklist = {player.Character}
	--
	for _, acc in pairs(workspace:GetDescendants()) do
		if acc:IsA("Accessory") then
			table.insert(blacklist, acc.Handle)
		end
	end
	
	--params for caster
	local castParams = RaycastParams.new()
	castParams.IgnoreWater = true
	castParams.FilterType = Enum.RaycastFilterType.Exclude
	castParams.FilterDescendantsInstances = blacklist
		

Let me know if it works.

2 Likes

I tested it out I see some difference and its better however it still doesn’t work properly, its same thing when I shoot the heat no damage

1 Like

Strange, Are you sure the bullet is not getting blocked by something else that’s on the head?, because the script does what is supposed to do. Blacklisting every accessorie’s handles.

Nope, just the accessories same issue

Try checking framework in replicated storage

Let me know if you have found a solution for this

(Still didn’t resolve the issue, looking for help)

Hold on I see something, Whenever i shoot at an accessory the bullets go up I will send you a video


Here is a video of what’s happening

Hmm, Try and do the same to other raycast blacklists that are in the projectile module or something.

what do you mean, projectile?

bbbbbbbbbbbbb