Nothing is getting added to FilterDescendantsInstances

Before you link me this post, I already tried the solution and it didn’t help.

The following code is inside of a LocalScript under a Tool:

local MouseCastParams = RaycastParams.new
MouseCastParams():AddToFilter(character)
MouseCastParams().FilterType = Enum.RaycastFilterType.Exclude
print(MouseCastParams().FilterDescendantsInstances)

Printing yields an empty table every time. character is the character model of the player who owns the tool. I’ve made sure the character isn’t nil; printing it returns the character’s name as it should. Not that it matters because I’ve tried putting other things into the filter and they don’t get added either.

I’ve tried adding to the filter via table.insert and it still didn’t work.
Everything else in the script runs just fine so I really don’t know what the issue is here. No errors in output.

Okay, for some ungodly reason, the autocomplete for RaycastParams.new() doesn’t add the paranthesis at the end. I just assumed that’s how it was supposed to be.

Even weirder, the autocomplete then adds parenthesis automatically every time you reference the RaycastParams afterward, even though it’s not supposed to. Why does this not throw any errors??? Tf roblox??

Fixed it and it works fine now:

local MouseCastParams = RaycastParams.new()
MouseCastParams:AddToFilter(char)
MouseCastParams.FilterType = Enum.RaycastFilterType.Exclude
print(MouseCastParams.FilterDescendantsInstances)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.