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

Multiple target filter objects?

How could I set the mouse.TargetFilter to contain two things? I'm making a block placing system, so I need to filter out the block that is currently being placed AND the player.

1 comment

0

The player is automatically filtered.

1 answer

PlayerMouse.TargetFilter can be an instance, and filters out the instance and all of its descendants. The first solution would be to have everything you want to filter be in the same parent.

If your problem was more general, you could take everything you want to filter, record their original parents, and then parent them to some model created in the script, set that model to the target filter, and at the end you can set everything back to their original parents.

However, it sounds like your problem is a bit more specific. In this case, I would recommend this:

  1. Place the block currently being placed in the character model (i.e. block.Parent = player.Character).
  2. Set mouse.TargetFilter = player.Character at the start.

Now the mouse should not recognize your character or the block being placed.

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