Ignore every descendant of workspace EXCEPT Terrain

I need to make a raycast that ignores everything that’s part of workspace except terrain, my script is as follows

local params = RaycastParams.new()
	params.IgnoreWater = false
	params.FilterDescendantsInstances = {game.Workspace}
	params.FilterType = Enum.RaycastFilterType.Blacklist

	local hit, position, normal, material = workspace:Raycast(Player.Character.HumanoidRootPart.Position,Vector3.new(0,-8,0),params)

Would there be a simple way to whitelist terrain while blacklisting everything else?

params.FilterDescendantsInstances = {game.Workspace.Terrain}
params.FilterType = Enum.RaycastFilterType.Whitelist

Can you try this? Whitelist will only check the parts that are in the table, in this case Terrain.

1 Like