local part = script.Parent local badpart = game.Workspace.shit while true do wait(1) raypar = RaycastParams.new() raypar.FilterDescendantsInstances = workspace.shit raypar.FilterType = Enum.RaycastFilterType.Blacklist local origin = part.Position local direction = part.CFrame.LookVector * 100 local result = workspace:Raycast(origin, direction, raypar) if result then print(result.Instance.Name) end if not result then print("nothing") end end
You forgot to introduce the curly braces, which look like this {} on line 6 where it says workspace.Part.
The reason it didn't work is because the script thinks that you're trying to set the value, which in this case is raypart to an object, which is the part, remember that FilteringStrings
are arrays.(tables)
Add the curly braces on line 06.
local part = script.Parent local badpart = game.Workspace.shit while true do wait(1) raypar = RaycastParams.new() raypar.FilterDescendantsInstances = {workspace.shit} raypar.FilterType = Enum.RaycastFilterType.Blacklist local origin = part.Position local direction = part.CFrame.LookVector * 100 local result = workspace:Raycast(origin, direction, raypar) if result then print(result.Instance.Name) end if not result then print("nothing") end end
Read the developer forums on :RayCastParams