Making A Swingable Tool That Collects A Currency From A Brick

I’m attempting to make a swingable tool that collects currency from a brick. Basically, like swinging a sword but if the sword is in proximity of the brick it will be able to collect currency from it.

I want it to be like in Bee Swarm Simulator or in Snow Shoveling Simulator, where you swing a tool and you get something from the brick.

I wasn’t able to find anything else similar to this. So if you help out, thank you in advance!

One way to accomplish this is to use Region3s, specifically FindPartsInRegion3, to get all objects in front of the character, or wherever your tool’s hitbox is, and check for whatever collectable( flowers if you’re talking about bee swarm simulator ) inside of that table of objects.

A second option is to use Rays. Here is a great resource that uses Ray’s to simulate a hitbox.
https://devforum.roblox.com/t/raycast-hitbox-update-3-0-for-all-your-melee-needs/37448
It works very efficiently and accurately.

Getting there distances between all collectibles with .Magnitude and some sort of loop would be extremely inefficient, which is why these options are better.

You can most likely make either of these methods work. It’s just a matter experimentation and which works better for your protect specifically.