I’m trying to make a gun using raycasts. The problem with this is that the raycast travels through parts. I’m unable to use FilterDescendantsInstances because there are just too many parts in my game to add them all to the table. Anyone got any solutions?
Code:
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {player.Character}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(script.Parent.Handle.Muzzle.Position, (mousePos - script.Parent.Handle.Muzzle.Position).Unit * 300, raycastParams)
I am not sure if this is a thing or not, but are do those parts have CanCollide == false? Cause maybe the raycast passes through them, because they cannot collide.