Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Multiple target filter objects?

Asked by 8 years ago

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.

0
The player is automatically filtered. cabbler 1942 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question