I have a Gun that is using workspace:raycast for hit detection, and using RaycastParams to ignore certain parts (descendants of the gun, and descendants of your LocalPlayer.Character).
For some reason, the RayCast result isn’t ignoring the filtered objects.
Relevant Code:
local RayCastFilter1 = RaycastParams.new()
RayCastFilter1.FilterType = Enum.RaycastFilterType.Blacklist;
RayCastFilter1.FilterDescendantsInstances = {LocalPlayer.Character;};
local RayCastFilter2 = RaycastParams.new()
RayCastFilter2.FilterType = Enum.RaycastFilterType.Blacklist;
RayCastFilter2.FilterDescendantsInstances = {script.Parent};
local UnitRay = Mouse.UnitRay.Direction
local RayCastHit = workspace:Raycast(Camera.CFrame.Position, UnitRay * MaxRange, RayCastFilter1, RayCastFilter2)
I tried that originally, and it didn’t work, so I tried using two separate filters to see if maybe that was the problem (apparently it’s wasn’t the problem)