RaycastParams Dont Work?!

  1. the problem is that when shooting a player in the head it detects the accessories my player added script my script adds the accessories to a collision group (That script works perfectly)

RemoteEvents Server

local RayParams = RaycastParams.new()
RayParams.FilterType = Enum.RaycastFilterType.Blacklist
RayParams.CollisionGroup = "Accessories"

Remotes.Shoot.OnServerEvent:Connect(function(player, BarrelPosition, direction)
	
	local result = game.Workspace:Raycast(BarrelPosition, direction, RayParams)
	
	if result then
		if result.Instance.Name == "Head" then
			local HeadShotSound = Sounds.Headshot:Clone()
			HeadShotSound.Parent = result.Instance
			HeadShotSound:Destroy()
			result.Instance.Parent.Humanoid:TakeDamage(1000)
		end
		print(result.Instance)
	end
end)

PlayerAdded ServerScript

local PhysicsService = game:GetService("PhysicsService")

game.Players.PlayerAdded:connect(function(player)
	
	player.CharacterAppearanceLoaded:Connect(function(character)
		for _, Accessory in pairs(character.Humanoid:GetAccessories()) do
			PhysicsService:SetPartCollisionGroup(Accessory.Handle, "Accessories")
		end
	end)
end)

Captura de pantalla 2022-07-15 180042

  1. I tried to look in other raycast scripts of mine but I didn’t find anything neither in the devforum
1 Like

Use ray cast hitbox, way easier. I know this isn’t a helpful response but trust me, ray cast hitbox is worth it, and you can use fastcast Roblox how to make smooth projectiles - YouTube

Ray cast Hitbox what is that???

Check the video I sent, It shows you what FastCast and RaycastHitbox are.

Ohh I saw, thanks for the help, but I want to use Raycast so that the bullet does not take long to reach the target and do the damage instantly. :sweat_smile:

1 Like

I think it’s a bug that has no solution…
What to solve it was instead to add all the accessories to the collision groups what I did was to disable the CanQuery and the CanTouch is the only solution I could find.
If someone knows the solution on the collision group, I will put it as a solution :pensive: