Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to make a ray ignore everything EXCEPT for specific bricks?

Basically what my question asked. Is there a way to have a ray ignore everything in the workspace except for specific bricks? Preferably a method that doesn't involve scanning the entire workspace to put all the bricks into a table and then remove those specific bricks. Thanks!

2 answers

✓ Accepted answer

The simple answer is No.

Without sticking everything that is not a parent of the bricks into a table, there's no way. That said, you can stick all of the bricks into a single Folder or Model and use the ignoreDescendentsInstance parameter of Workspace:FindPartOnRay()

1 comment

0

Eh, alright. Thanks anyways!

Adding on to eLunate, it may be easier to simply check what you hit. Instead of ignoring all but a few bricks, just make sure what you hit are those bricks.

if hit.Name == "SpecialBrick" then

2 comments

0

Checking them assumes that the ray is not meant to ignore the parts, but instead the code is meant to ignore it.

0

This makes sure that the part you hit is the 'special' part. It would be easier than ignoring all other parts, and would still work fine in most situations.

This discussion is preserved as it was. New answers, comments, and votes are closed.