How to get Parts in an area of mouse.Hit?

How do I get the Parts around an area of mouse.Hit?

I want to make it that the parts destroy when you click on them

here is a sketch of what I mean

1 Like

Extremely easy with the new Spatial Query API

local Radius = 10
local Params = Instance.new("OverlapParams")

-- Perhaps you will want to configure the params to ignore something like the baseplate
-- but you could also just filter those out when iterating over Parts array

local Parts = Workspace:GetPartBoundsInRadius(Mouse.Hit.Position, Radius, Params)
2 Likes

Continuing on your script:

for index, part in pairs(Parts) do
    part:Destroy()
end

Or if they wanted explosion:

for index, part in pairs(Parts) do
    local Exp = Instance.new("Explosion", part)
    Exp.Position = part.Position
end

Also this is partially incorrect.

I believe it is OverlapParams.new().

Tried your script and it’s returning null.